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

Re: [PATCH v2 2/2] wt-status: tolerate dangling marks

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Aug 31, 2020, 17:17 UTC
Message-ID
<20200831171732.1199755-1-jonathantanmy@google.com>
In-Reply-To
<xmqqo8mti8od.fsf@gitster.c.googlers.com>
Show 16 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
> 
> > +
> > +	/*
> > +	 * If ^{upstream} or ^{push} (or equivalent) is requested, and the
> > +	 * branch in question does not have such a reference, return -1 instead
> > +	 * of die()-ing.
> > +	 */
> > +	unsigned nonfatal_dangling_mark : 1;
> 
> Micronit; I would have avoided "or equivalent" as the point of
> parenthetical comment was not to say these two modifiers upstream
> and push (and other forms that spell differently but invokes exactly
> one of these two features) are special, but to say that these two
> are merely examples, and any other ^{modifiers} we have or we will
> add in the future would honor this bit.  Perhaps "(and the like)"?
"(and the like)" sounds good.
> Among these callers that reach substitute_branch_name(), how were
> those that can specify the new bit chosen?
I just did the minimal change to fix the bug in the test.
Show 11 quoted lines
> For example, what is the reasoning behind making dwim_ref() unable
> to ask the "do so gently" variant, while allowing repo_dwim_ref()
> to?
> 
> I am NOT necessarily saying these two functions MUST be able to
> access the same set of features and the only difference between them
> MUST be kept to the current "repo_* variant can work on an arbitrary
> repository, while the variant without repo_* would work on the
> primary repository only".  As long as there is a good reason to make
> their power diverge, it is OK---I just do not see why and I'd like
> to know.

Maybe add the following to the end of the last paragraph of the commit message:

  (dwim_ref() is unchanged because I expect more and more code to use
  repo_dwim_ref(), and to reduce the size of the diff.)

If you prefer not to make this change locally, let me know and I'll resend one with the updated commit message and the "(and the like)" change above.

> The same question about not allowing the gentler variant while
> drimming the reflog.

Same as above - I only did the minimal change to fix the bug. Admittedly, if a reflog-accessing command could fail in the same way (dangling mark), we would need to fix repo_dwim_log() and then we could simplify substitute_branch_name() to not take the nonfatal_dangling_mark parameter (since all dangling marks would now be nonfatal), but I haven't looked beyond this.

Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 17 in “wt-status: expand, not dwim, a "detached from" ref”
  1. wt-status: expand, not dwim, a "detached from" refJonathan Tan, May 13, 2020
  2. Junio C HamanoMay 13, 2020
  3. Junio C HamanoMay 13, 2020
  4. Jonathan TanMay 18, 2020
  5. Jonathan NiederAug 27, 2020
  6. Junio C HamanoAug 27, 2020
  7. 0/2 Fix for git checkout @{u} (non-local) then git statusJonathan Tan, Aug 29, 2020
  8. 1/2 sha1-name: replace unsigned int with option structJonathan Tan, Aug 29, 2020
  9. Junio C HamanoAug 29, 2020
  10. 2/2 wt-status: tolerate dangling marksJonathan Tan, Aug 29, 2020
  11. Junio C HamanoAug 29, 2020
  12. Jonathan TanAug 31, 2020
  13. Junio C HamanoAug 31, 2020
  14. 0/3 Fix for git checkout @{u} (non-local) then git statusJonathan Tan, Sep 1, 2020
  15. 1/3 sha1-name: replace unsigned int with option structJonathan Tan, Sep 1, 2020
  16. 2/3 refs: move dwim_ref() to header fileJonathan Tan, Sep 1, 2020
  17. 3/3 wt-status: tolerate dangling marksJonathan Tan, Sep 1, 2020

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.