From 5d8863954f077d2c262d5cc4fc669947ff23d6d5 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Fri, 4 May 2012 20:14:48 +0200 Subject: checkout (detached): truncate list of orphaned commits at the new HEAD When git checkout switches from a detached HEAD to any other commit, then all orphaned commits were listed in a warning: Warning: you are leaving 2 commits behind...: a5e5396 another fixup 6aa1af6 fixup foo But if the new commit is actually one from this list (6aa1af6 in this example), then the list in the warning can be truncated at the new HEAD, because history beginning at HEAD is not "left behind". This makes it so. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t2020-checkout-detach.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t2020-checkout-detach.sh') diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh index 202ca90c34..f63333b64e 100755 --- a/t/t2020-checkout-detach.sh +++ b/t/t2020-checkout-detach.sh @@ -126,7 +126,7 @@ test_expect_success 'checkout warns orphaning 1 of 2 commits' ' ' test_expect_success 'checkout warns orphaning 1 of 2 commits: output' ' - check_orphan_warning stderr "2 commits" + check_orphan_warning stderr "1 commit" ' test_expect_success 'checkout does not warn leaving ref tip' ' -- cgit v1.2.1