summaryrefslogtreecommitdiff
path: root/t/t9500-gitweb-standalone-no-errors.sh
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2012-02-15 16:37:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-20 06:21:35 (GMT)
commitfc8fcd27e67ad06689a823dd83a929624e359cc1 (patch)
tree979c8b7b1c9929a49b335f89b68924f3708adba1 /t/t9500-gitweb-standalone-no-errors.sh
parentd1ba7a4cb77b64993a56b06c1497d1ab78094cc4 (diff)
downloadgit-fc8fcd27e67ad06689a823dd83a929624e359cc1.zip
git-fc8fcd27e67ad06689a823dd83a929624e359cc1.tar.gz
git-fc8fcd27e67ad06689a823dd83a929624e359cc1.tar.bz2
gitweb: Fix 'grep' search for multiple matches in file
Commit ff7f218 (gitweb: Fix file links in "grep" search, 2012-01-05), added $file_href variable, to reduce duplication and have the fix applied in single place. Unfortunately it made variable defined inside the loop, not taking into account the fact that $file_href was set only if file changed. Therefore for files with multiple matches $file_href was undefined for second and subsequent matches. Fix this bug by moving $file_href declaration outside loop. Adds tests for almost all forms of sarch in gitweb, which were missing from testuite. Note that it only tests if there are no warnings, and it doesn't check that gitweb finds what it should find. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9500-gitweb-standalone-no-errors.sh')
-rwxr-xr-xt/t9500-gitweb-standalone-no-errors.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index ab24917..3e4fdbe 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -630,6 +630,45 @@ test_expect_success \
'gitweb_run "p=.git;a=tree"'
# ----------------------------------------------------------------------
+# searching
+
+cat >>gitweb_config.perl <<\EOF
+
+# enable search
+$feature{'search'}{'default'} = [1];
+$feature{'grep'}{'default'} = [1];
+$feature{'pickaxe'}{'default'} = [1];
+EOF
+
+test_expect_success \
+ 'search: preparation' \
+ 'echo "1st MATCH" >>file &&
+ echo "2nd MATCH" >>file &&
+ echo "MATCH" >>bar &&
+ git add file bar &&
+ git commit -m "Added MATCH word"'
+
+test_expect_success \
+ 'search: commit author' \
+ 'gitweb_run "p=.git;a=search;h=HEAD;st=author;s=A+U+Thor"'
+
+test_expect_success \
+ 'search: commit message' \
+ 'gitweb_run "p=.git;a=search;h=HEAD;st=commitr;s=MATCH"'
+
+test_expect_success \
+ 'search: grep' \
+ 'gitweb_run "p=.git;a=search;h=HEAD;st=grep;s=MATCH"'
+
+test_expect_success \
+ 'search: pickaxe' \
+ 'gitweb_run "p=.git;a=search;h=HEAD;st=pickaxe;s=MATCH"'
+
+test_expect_success \
+ 'search: projects' \
+ 'gitweb_run "a=project_list;s=.git"'
+
+# ----------------------------------------------------------------------
# non-ASCII in README.html
test_expect_success \