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

Re: [PATCH 5/6] status: do not depend on flaky reflog messages

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 14, 2013, 16:31 UTC
Message-ID
<7vsj0kpsb0.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0n_Jsb46qPojbGL3S+mPunNQWUOmypQOvdaBjcT5wgJBg@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 11 quoted lines
> Junio C Hamano wrote:
>> As I said (twice), you can argue that that particular piece of
>> information is not useful (at least to you), but why it is not
>> useful has to be justified, against the justification given by
>> b397ea4863a1 (status: show more info than "currently not on any
>> branch", 2013-03-13) and people who have been using that information
>> in the status output, no?
>
> Yes, Junio.  I cannot justify that "detached HEAD from" is completely
> useless, because it is not.  I argued for a practical compromise, and
> have tried to show the huge negative impact against the marginal gain.

First of all, during a stopped "git rebase", I think "git status" that says "# HEAD detached at" or "# HEAD detached from" is not something we want in the end result anyway. In either case, that comes from the internal use of "git checkout" by the command to switch out of a concrete branch, which is *not* user initiated.

If you first update "git checkout" so that it will pay attention to a custom reflog-action exported by Porcelain scripts that may want to internally use it to flip branches (and without a custom one, it will still record "checkout: moving from A to B"), without exporting custom reflog-action from "rebase" and other Porcelain scripts, that would not affect any externally visible behaviour.

When you teach "git rebase" to pass custom reflog-action when it detaches the HEAD at "$onto^0" (because that is not a user-initiated action) as the next step, nth_prior_checkout and 1st_switch would stop counting them as "checkout" events. That fix will give you the desired result of the topic of this series, i.e. "git checkout @{-1}" ignores the internal "git checkout" done by "rebase".

That step may change the output from "git status" but I do not think the output from "git status" in this sequence:

	git rebase ;# stops upon conflict
        git status

is anything sacred. Tests modified by b397ea4863a1 (status: show more info than "currently not on any branch", 2013-03-13) do change the original "# Not currently on any branch" to "detached at", but I do not think b397ea4863a1 _wanted_ to say where the $onto commit was during the rebase (or was it?), so if they have to change to "detached from", I do not think it is a problem at all. I think it is very sane to update these selected "detached at" to "detached from" as needed.

That would be a sensible compromise, because we do not want to see either "detached at" or "detached from" during "rebase" in the longer term. We would rather want to see the message start with something like

	# Rebasing X on top of Y (23 commits remaining to be replayed)

which is under discussion in a separate thread lately. The change to expected output (i.e. "detached at" to "detached from") will have to be changed again in that separate topic.

The very last test that the b397ea4863a1 added, which wants to see "detached at atag", should be kept, and also there should be another test added to reset one step back to make sure we see "detached from" after it. It tests what the user sees after a "git checkout" initiated by the end-user.

Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 23 of 37 in “Fix git checkout - with rebase”
  1. 0/6 Fix git checkout - with rebaseRamkumar Ramachandra, Jun 13, 2013
  2. 1/6 t/checkout-last: checkout - doesn't work after rebaseRamkumar Ramachandra, Jun 13, 2013
  3. Junio C HamanoJun 13, 2013
  4. Ramkumar RamachandraJun 13, 2013
  5. Junio C HamanoJun 13, 2013
  6. 2/6 rebase: prepare to write reflog message for checkoutRamkumar Ramachandra, Jun 13, 2013
  7. Junio C HamanoJun 13, 2013
  8. Ramkumar RamachandraJun 13, 2013
  9. 3/6 rebase -i: prepare to write reflog message for checkoutRamkumar Ramachandra, Jun 13, 2013
  10. Junio C HamanoJun 13, 2013
  11. 4/6 wt-status: remove unused field in grab_1st_switch_cbdataRamkumar Ramachandra, Jun 13, 2013
  12. Junio C HamanoJun 13, 2013
  13. 5/6 status: do not depend on flaky reflog messagesRamkumar Ramachandra, Jun 13, 2013
  14. Junio C HamanoJun 13, 2013
  15. Ramkumar RamachandraJun 13, 2013
  16. Ramkumar RamachandraJun 13, 2013
  17. Junio C HamanoJun 13, 2013
  18. Ramkumar RamachandraJun 14, 2013
  19. Junio C HamanoJun 14, 2013
  20. Ramkumar RamachandraJun 14, 2013
  21. Junio C HamanoJun 14, 2013
  22. Ramkumar RamachandraJun 14, 2013
  23. Junio C HamanoJun 14, 2013
  24. Ramkumar RamachandraJun 14, 2013
  25. Junio C HamanoJun 14, 2013
  26. Junio C HamanoJun 14, 2013
  27. Junio C HamanoJun 14, 2013
  28. Ramkumar RamachandraJun 15, 2013
  29. Junio C HamanoJun 15, 2013
  30. Ramkumar RamachandraJun 15, 2013
  31. Ramkumar RamachandraJun 15, 2013
  32. Junio C HamanoJun 15, 2013
  33. Ramkumar RamachandraJun 15, 2013
  34. Junio C HamanoJun 16, 2013
  35. Ramkumar RamachandraJun 16, 2013
  36. Junio C HamanoJun 15, 2013
  37. 6/6 checkout: respect GIT_REFLOG_ACTIONRamkumar Ramachandra, Jun 13, 2013

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.