summaryrefslogtreecommitdiffstats
path: root/t/t4208-log-magic-pathspec.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-04-10 02:03:45 +0200
committerJunio C Hamano <gitster@pobox.com>2020-04-10 02:22:20 +0200
commit5ff4b920ebeadfa640f1b7d5929f58bb180a0519 (patch)
treeda2742e849d99608a92d1c99a0985b701b878959 /t/t4208-log-magic-pathspec.sh
parentsha1-name.c: remove the_repo from handle_one_ref() (diff)
downloadgit-5ff4b920ebeadfa640f1b7d5929f58bb180a0519.tar.xz
git-5ff4b920ebeadfa640f1b7d5929f58bb180a0519.zip
sha1-name: do not assume that the ref store is initialized
c931ba4e (sha1-name.c: remove the_repo from handle_one_ref(), 2019-04-16) replaced the use of for_each_ref() helper, which works with the main ref store of the default repository instance, with refs_for_each_ref(), which can work on any ref store instance, by assuming that the repository instance the function is given has its ref store already initialized. But it is possible that nobody has initialized it, in which case, the code ends up dereferencing a NULL pointer. Reported-by: Érico Rolim <erico.erc@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-xt/t4208-log-magic-pathspec.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh
index 4c8f3b8e1b..6cdbe4747a 100755
--- a/t/t4208-log-magic-pathspec.sh
+++ b/t/t4208-log-magic-pathspec.sh
@@ -55,6 +55,10 @@ test_expect_success '"git log -- :/a" should not be ambiguous' '
git log -- :/a
'
+test_expect_success '"git log :/any/path/" should not segfault' '
+ test_must_fail git log :/any/path/
+'
+
# This differs from the ":/a" check above in that :/in looks like a pathspec,
# but doesn't match an actual file.
test_expect_success '"git log :/in" should not be ambiguous' '