Skip to content

Commit 2c8fb23

Browse files
committed
Merge branch 'maint'
* maint: Update draft release notes to 1.7.9.2 gitweb: Fix 'grep' search for multiple matches in file
2 parents b0d66b5 + 233054d commit 2c8fb23

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

Documentation/RelNotes/1.7.9.2.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ Fixes since v1.7.9.1
2424

2525
* Search box in "gitweb" did not accept non-ASCII characters correctly.
2626

27+
* Search interface of "gitweb" did not show multiple matches in the same file
28+
correctly.
29+
2730
Also contains minor fixes and documentation updates.

gitweb/gitweb.perl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5915,9 +5915,10 @@ sub git_search_files {
59155915
my $alternate = 1;
59165916
my $matches = 0;
59175917
my $lastfile = '';
5918+
my $file_href;
59185919
while (my $line = <$fd>) {
59195920
chomp $line;
5920-
my ($file, $file_href, $lno, $ltext, $binary);
5921+
my ($file, $lno, $ltext, $binary);
59215922
last if ($matches++ > 1000);
59225923
if ($line =~ /^Binary file (.+) matches$/) {
59235924
$file = $1;

t/t9500-gitweb-standalone-no-errors.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,45 @@ test_expect_success \
637637
'config override: tree view, features enabled in repo config (2)' \
638638
'gitweb_run "p=.git;a=tree"'
639639

640+
# ----------------------------------------------------------------------
641+
# searching
642+
643+
cat >>gitweb_config.perl <<\EOF
644+
645+
# enable search
646+
$feature{'search'}{'default'} = [1];
647+
$feature{'grep'}{'default'} = [1];
648+
$feature{'pickaxe'}{'default'} = [1];
649+
EOF
650+
651+
test_expect_success \
652+
'search: preparation' \
653+
'echo "1st MATCH" >>file &&
654+
echo "2nd MATCH" >>file &&
655+
echo "MATCH" >>bar &&
656+
git add file bar &&
657+
git commit -m "Added MATCH word"'
658+
659+
test_expect_success \
660+
'search: commit author' \
661+
'gitweb_run "p=.git;a=search;h=HEAD;st=author;s=A+U+Thor"'
662+
663+
test_expect_success \
664+
'search: commit message' \
665+
'gitweb_run "p=.git;a=search;h=HEAD;st=commitr;s=MATCH"'
666+
667+
test_expect_success \
668+
'search: grep' \
669+
'gitweb_run "p=.git;a=search;h=HEAD;st=grep;s=MATCH"'
670+
671+
test_expect_success \
672+
'search: pickaxe' \
673+
'gitweb_run "p=.git;a=search;h=HEAD;st=pickaxe;s=MATCH"'
674+
675+
test_expect_success \
676+
'search: projects' \
677+
'gitweb_run "a=project_list;s=.git"'
678+
640679
# ----------------------------------------------------------------------
641680
# non-ASCII in README.html
642681

0 commit comments

Comments
 (0)