diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-10-16 23:57:48 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-10-17 00:10:33 -0700 |
commit | 7641eb400f8dc1c8b8b0ca8f325c753ae566e156 (patch) | |
tree | e1040c294ba8c74c8f808161021b4b9084ac6399 | |
parent | c274db7057318835e975c26284f6f9d723b938f3 (diff) | |
parent | b142da2a5dec8f868a61322e2ab591e9a008ec3b (diff) | |
download | git-7641eb400f8dc1c8b8b0ca8f325c753ae566e156.tar.gz |
Merge branch 'maint'
* maint:
GIT 1.6.5.1
grep: do not segfault when -f is used
-rw-r--r-- | Documentation/RelNotes-1.6.5.1.txt | 20 | ||||
-rw-r--r-- | Documentation/git.txt | 1 | ||||
-rw-r--r-- | builtin-grep.c | 2 | ||||
-rwxr-xr-x | t/t7002-grep.sh | 66 |
4 files changed, 88 insertions, 1 deletions
diff --git a/Documentation/RelNotes-1.6.5.1.txt b/Documentation/RelNotes-1.6.5.1.txt new file mode 100644 index 0000000000..309ba181b2 --- /dev/null +++ b/Documentation/RelNotes-1.6.5.1.txt @@ -0,0 +1,20 @@ +GIT v1.6.5.1 Release Notes +========================== + +Fixes since v1.6.5 +------------------ + + * An corrupt pack could make codepath to read objects into an + infinite loop. + + * Download throughput display was always shown in KiB/s but on fast links + it is more appropriate to show it in MiB/s. + + * "git grep -f filename" used uninitialized variable and segfaulted. + + * "git clone -b branch" gave a wrong commit object name to post-checkout + hook. + + * "git pull" over http did not work on msys. + +Other minor documentation updates are included. diff --git a/Documentation/git.txt b/Documentation/git.txt index d97aaf5bf8..d11c5c1651 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -46,6 +46,7 @@ Documentation for older releases are available here: * link:v1.6.5/git.html[documentation for release 1.6.5] * release notes for + link:RelNotes-1.6.5.1.txt[1.6.5.1], link:RelNotes-1.6.5.txt[1.6.5]. * link:v1.6.4.4/git.html[documentation for release 1.6.4.4] diff --git a/builtin-grep.c b/builtin-grep.c index 761799d7d0..1df25b07b5 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -631,7 +631,7 @@ static int file_callback(const struct option *opt, const char *arg, int unset) struct grep_opt *grep_opt = opt->value; FILE *patterns; int lno = 0; - struct strbuf sb; + struct strbuf sb = STRBUF_INIT; patterns = fopen(arg, "r"); if (!patterns) diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index ae56a36eac..ae5290ab43 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -213,6 +213,72 @@ test_expect_success 'grep -e A --and --not -e B' ' test_cmp expected actual ' +test_expect_success 'grep -f, non-existent file' ' + test_must_fail git grep -f patterns +' + +cat >expected <<EOF +file:foo mmap bar +file:foo_mmap bar +file:foo_mmap bar mmap +file:foo mmap bar_mmap +file:foo_mmap bar mmap baz +EOF + +cat >pattern <<EOF +mmap +EOF + +test_expect_success 'grep -f, one pattern' ' + git grep -f pattern >actual && + test_cmp expected actual +' + +cat >expected <<EOF +file:foo mmap bar +file:foo_mmap bar +file:foo_mmap bar mmap +file:foo mmap bar_mmap +file:foo_mmap bar mmap baz +t/a/v:vvv +t/v:vvv +v:vvv +EOF + +cat >patterns <<EOF +mmap +vvv +EOF + +test_expect_success 'grep -f, multiple patterns' ' + git grep -f patterns >actual && + test_cmp expected actual +' + +cat >expected <<EOF +file:foo mmap bar +file:foo_mmap bar +file:foo_mmap bar mmap +file:foo mmap bar_mmap +file:foo_mmap bar mmap baz +t/a/v:vvv +t/v:vvv +v:vvv +EOF + +cat >patterns <<EOF + +mmap + +vvv + +EOF + +test_expect_success 'grep -f, ignore empty lines' ' + git grep -f patterns >actual && + test_cmp expected actual +' + cat >expected <<EOF y:y yy -- |