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

Re: [PATCH] checkout: special case error messages during noop switching

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2024, 16:15 UTC
Message-ID
<xmqqttgo3shk.fsf@gitster.g>
In-Reply-To
<CANiSa6hs1AEp1e+o0hT55DvCwPe2EUyU1EXg1E4BKCkeuEOPvw@mail.gmail.com>
Martin von Zweigbergk <martinvonz@gmail.com> writes:
Show 7 quoted lines
>>  * Yes, the end-users are irrational.  When they did not give
>>    "--ours", they take it granted that "git checkout" gives a short
>>    status, e.g..
>
> I actually did not even know that it does that :) I'm a bit surprised
> that it does, especially since `git checkout <non-HEAD>` doesn't seem
> to do that. But that's off topic.
It does but you wouldn't know unless you have modified paths.

Also checkout and switch would only allow checking out another branch when these modified paths are the same between the original HEAD and the other branch.

        $ git reset --hard
        $ echo >>GIT-VERSION-GEN
        $ git checkout
	M       GIT-VERSION-GEN
With a modified file, no-op checkout, report only.
	$ git checkout next
	M       GIT-VERSION-GEN
	Switched to branch 'next'
With a modified file, checkout another branch, with report.
	$ git checkout maint
	error: Your local changes to the following files would be overwritten...
		GIT-VERSION-GEN
	Please commit your changes or stash them...

With a modified file, that is different between next and maint, fail to checkout the other branch.

Previous: Martin von ZweigbergkNext: Junio C Hamano
Message 3 of 4 in “checkout: special case error messages during noop switching”
  1. checkout: special case error messages during noop switchingJunio C Hamano, Jul 2, 2024
  2. Martin von ZweigbergkJul 17, 2024
  3. Junio C HamanoJul 17, 2024
  4. Junio C HamanoJul 17, 2024

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.