git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] test: checkout shouldn't say that HEAD has moved if it didn't

From
Nanako Shiraishi <nanako3@lavabit.com>
Date
May 17, 2009, 02:43 UTC
Message-ID
<20090517114308.6117@nanako3.lavabit.com>
In-Reply-To
<7vr5yolt1j.fsf@alter.siamese.dyndns.org>
Signed-off-by: しらいしななこ <nanako3@lavabit.com>
---
Quoting Junio C Hamano <gitster@pobox.com>:
Show 11 quoted lines
> Daniel Cordero <theappleman@gmail.com> writes:
>
>> Previously, checkout would tell the user this message before moving HEAD,
>> without regard to whether the upcoming move will result in success.
>> If the move failed, this causes confusion.
>>
>> Show the message after the move, unless the move failed.
>>
>> Signed-off-by: Daniel Cordero <theappleman@gmail.com>
>
> Thanks; the patch looks obviously good.  Can we have tests?
Here is one.
 t/t7201-co.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index bdb808a..ebfd34d 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -534,4 +534,12 @@ test_expect_success 'failing checkout -b should not break working tree' '
 
 '
 
+test_expect_success 'switch out of non-branch' '
+	git reset --hard master &&
+	git checkout master^0 &&
+	echo modified >one &&
+	test_must_fail git checkout renamer 2>error.log &&
+	! grep "^Previous HEAD" error.log
+'
+
 test_done
-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Previous: Junio C Hamano
Message 4 of 4 in “[buglet] misleading error message from git checkout”
  1. Nanako ShiraishiMay 16, 2009
  2. builtin-checkout: Don't tell user that HEAD has moved before it hasDaniel Cordero, May 16, 2009
  3. Junio C HamanoMay 16, 2009
  4. test: checkout shouldn't say that HEAD has moved if it didn'tNanako Shiraishi, May 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.