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

Re: [PATCH v2 2/2] status: improve rebase todo list parsing

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Jun 22, 2026, 08:36 UTC
Message-ID
<056b742b-7a9c-4b1a-80d6-1fcc7c51ad57@gmail.com>
In-Reply-To
<xmqqqzmdoya9.fsf@gitster.g>
On 11/06/2026 17:08, Junio C Hamano wrote:
Show 29 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> Hi Junio
>>
>> On 31/05/2026 01:46, Junio C Hamano wrote:
>>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>>
>>>> +static void abbrev_oid_in_line(struct repository *r,
>>>> +			       struct strbuf *line, char **pp)
>>>> +{
>>>> ...
>>>> +	have_oid = !repo_get_oid(r, p, &oid);
>>>> +	*end_of_object_name = saved;
>>>> +	if (!have_oid)
>>>> +		goto out; /* object name was a label */
>>>
>>> Can there be a label "deadbeef123" that is unrelated to an object whose
>>> object name happens to abbreviate to "deadbeef123"?
>>
>> In theory yes, but I had assumed it was so unlikely to happen that we
>> could ignore it. If we want to be more careful then we could add a "bool
>> maybe_label" argument for commands that accept a label or a revision and
>> check if "refs/rewritten/$object_name" exists before trying repo_get_oid().
> 
> To me, how rare the possibility of such a bug happening is of
> secondary importance.  What affects the decision more is when the
> "rare" failure happens, if it is immediately obvious to the user,
> and if the user may be further harmed badly if they used the wrong
> information given by the tool due to such a "rare" failure.

That's a good point - I should have been clearer that I thought the consequences were not serious so and while we wouldn't want to misinterpret labels on a regular basis it didn't matter we did so very occasionally.

Show 13 quoted lines
> It would be a huge plus if the workaround, when such a "rare"
> failure triggers, would be immediately obvious to the user.
> 
> What we do not want to see is that the tool to create a wrong
> result, cascading into more problems, silently.  In a sense, it is
> even worse if such a bug triggers only rarely, because it would mean
> that the users always have to be on the lookout.
> 
> Having said all that.
> 
> I suspect that the OID in the output generated by "status" after it
> parses rebase "todo list" is merely meant as an eye candy, and the
> users do not _use_ it to decide further actions based on them.
That's my suspicion as well
Show 5 quoted lines
> Or do people stare at "git status" output, find an interesting
> object name and go "git show" on it or something?  If not, then even
> if such a failure were not rare, it would be OK.  We may however
> want to record i as a limitation of the current implementation in
> the end-user facing documentation, though.

I've updated the implementation to check for a label before trying to abbreviate the object name.

Thanks
Phillip
> 
> Thanks.
> 
> 
Previous: Junio C HamanoNext: Phillip Wood
Message 17 of 29 in “status: improve rebase todo list parsing”
  1. 0/2 status: improve rebase todo list parsingPhillip Wood, Apr 20, 2026
  2. 1/2 sequencer: factor out parsing of todo commandsPhillip Wood, Apr 20, 2026
  3. Elijah NewrenApr 22, 2026
  4. 2/2 status: improve rebase todo list parsingPhillip Wood, Apr 20, 2026
  5. Tian YuchenApr 20, 2026
  6. Phillip WoodApr 21, 2026
  7. Elijah NewrenApr 22, 2026
  8. Patrick SteinhardtApr 22, 2026
  9. Phillip WoodApr 22, 2026
  10. Phillip WoodApr 22, 2026
  11. 0/2 status: improve rebase todo list parsingPhillip Wood, May 1, 2026
  12. 1/2 sequencer: factor out parsing of todo commandsPhillip Wood, May 1, 2026
  13. 2/2 status: improve rebase todo list parsingPhillip Wood, May 1, 2026
  14. Junio C HamanoMay 31, 2026
  15. Phillip WoodJun 1, 2026
  16. Junio C HamanoJun 11, 2026
  17. Phillip WoodJun 22, 2026
  18. Phillip WoodMay 1, 2026
  19. 0/2 status: improve rebase todo list parsingPhillip Wood, Jun 22, 2026
  20. 1/2 sequencer: factor out parsing of todo commandsPhillip Wood, Jun 22, 2026
  21. Junio C HamanoJun 22, 2026
  22. Phillip WoodJun 23, 2026
  23. 2/2 status: improve rebase todo list parsingPhillip Wood, Jun 22, 2026
  24. Junio C HamanoJun 22, 2026
  25. Junio C HamanoJun 22, 2026
  26. Phillip WoodJun 23, 2026
  27. 0/2 status: improve rebase todo list parsingPhillip Wood, Jun 23, 2026
  28. 1/2 sequencer: factor out parsing of todo commandsPhillip Wood, Jun 23, 2026
  29. 2/2 status: improve rebase todo list parsingPhillip Wood, Jun 23, 2026

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.