summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9904fad)
raw | patch | inline | side by side (parent: 9904fad)
author | Junio C Hamano <gitster@pobox.com> | |
Sat, 11 Sep 2010 18:47:09 +0000 (11:47 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 12 Sep 2010 20:52:03 +0000 (13:52 -0700) |
When applying two pathspecs, one of which is named as a prefix to the
other, we mistakenly recursed into the shorter one.
Noticed and fixed by David Reis.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
other, we mistakenly recursed into the shorter one.
Noticed and fixed by David Reis.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-tree.c | patch | blob | history | |
t/t3100-ls-tree-restrict.sh | patch | blob | history |
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index dc86b0d9a997f98ad43ca2897055a92b8a3eb7d0..a8187568bf99872e717c389b031331838544fe04 100644 (file)
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
speclen = strlen(spec);
if (speclen <= len)
continue;
+ if (spec[len] && spec[len] != '/')
+ continue;
if (memcmp(pathname, spec, len))
continue;
return 1;
index eee0d344d24623ad9928366729c8efaea699fcd7..81d90b66c50e75323a44aaf5e2e067d5a3569e6a 100755 (executable)
EOF
test_output'
+test_expect_success \
+ 'ls-tree with one path a prefix of the other' \
+ 'git ls-tree $tree path2/baz path2/bazbo >current &&
+ make_expected <<\EOF &&
+040000 tree X path2/baz
+120000 blob X path2/bazbo
+EOF
+ test_output'
+
test_done