summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-01-07 01:12:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-08 03:20:07 (GMT)
commitb10731f43dc21fa47c275052e7c074c686335cd3 (patch)
treea8dec989c054725eb2f0605aef101aca5c17d403 /t
parent0b65a8dbdb38962e700ee16776a3042beb489060 (diff)
downloadgit-b10731f43dc21fa47c275052e7c074c686335cd3.zip
git-b10731f43dc21fa47c275052e7c074c686335cd3.tar.gz
git-b10731f43dc21fa47c275052e7c074c686335cd3.tar.bz2
branch_get_push: do not segfault when HEAD is detached
Move the detached HEAD check from branch_get_push_1() to branch_get_push() to avoid setting branch->push_tracking_ref when branch is NULL. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1514-rev-parse-push.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t1514-rev-parse-push.sh b/t/t1514-rev-parse-push.sh
index 7214f5b..623a32a 100755
--- a/t/t1514-rev-parse-push.sh
+++ b/t/t1514-rev-parse-push.sh
@@ -60,4 +60,10 @@ test_expect_success '@{push} with push refspecs' '
resolve topic@{push} refs/remotes/origin/magic/topic
'
+test_expect_success 'resolving @{push} fails with a detached HEAD' '
+ git checkout HEAD^0 &&
+ test_when_finished "git checkout -" &&
+ test_must_fail git rev-parse @{push}
+'
+
test_done