aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-11-23 11:23:16 -0800
committerJunio C Hamano <gitster@pobox.com>2016-11-23 11:23:16 -0800
commit48e9ad5ef3afd39168e2fb72d0ce7ac5f7124d31 (patch)
treecc1d0d3e96248ff01d1449eb5999a7ebed632724 /t
parent1e37181391e305a7ab0c382ca3c3b2de998d4138 (diff)
parent84679d470d577bcde1b6aa6af36c08a2d77b6e68 (diff)
downloadgit-48e9ad5ef3afd39168e2fb72d0ce7ac5f7124d31.tar.gz
git-48e9ad5ef3afd39168e2fb72d0ce7ac5f7124d31.tar.xz
Merge branch 'jc/for-each-ref-head-segfault-fix'
Using a %(HEAD) placeholder in "for-each-ref --format=" option caused the command to segfault when on an unborn branch. * jc/for-each-ref-head-segfault-fix: for-each-ref: do not segv with %(HEAD) on an unborn branch
Diffstat (limited to 't')
-rwxr-xr-xt/t6300-for-each-ref.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 19a282302..039509a9c 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -553,4 +553,14 @@ test_expect_success 'Verify sort with multiple keys' '
refs/tags/bogo refs/tags/master > actual &&
test_cmp expected actual
'
+
+test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
+ test_when_finished "git checkout master" &&
+ git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
+ sed -e "s/^\* / /" actual >expect &&
+ git checkout --orphan HEAD &&
+ git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
+ test_cmp expect actual
+'
+
test_done