diff options
author | Kyle Meyer <kyle@kyleam.com> | 2017-01-06 20:12:15 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-07 19:20:07 -0800 |
commit | b10731f43dc21fa47c275052e7c074c686335cd3 (patch) | |
tree | a8dec989c054725eb2f0605aef101aca5c17d403 /t | |
parent | 0b65a8dbdb38962e700ee16776a3042beb489060 (diff) | |
download | git-b10731f43dc21fa47c275052e7c074c686335cd3.tar.gz |
branch_get_push: do not segfault when HEAD is detachedkm/branch-get-push-while-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-x | t/t1514-rev-parse-push.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t1514-rev-parse-push.sh b/t/t1514-rev-parse-push.sh index 7214f5b33f..623a32aa6e 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 |