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

Re: [PATCH 3/4] am: support --show-current-patch=raw as a synonym for--show-current-patch

From
Paolo Bonzini <pbonzini@redhat.com>
Date
Feb 19, 2020, 20:53 UTC
Message-ID
<217229b8-3a72-55fb-71c6-8ba8ae3ceb0b@redhat.com>
In-Reply-To
<xmqqmu9ee3hc.fsf@gitster-ct.c.googlers.com>
On 19/02/20 21:17, Junio C Hamano wrote:
Show 15 quoted lines
>>> +       if (resume->mode == RESUME_SHOW_PATCH && new_value != resume->sub_mode)
>>> +               return error(_("--show-current-patch=%s is incompatible with "
>>> +                              "--show-current-patch=%s"),
>>> +                            arg, valid_modes[resume->sub_mode]);
>>
>> So, this allows --show-current-patch=<foo> to be specified multiple
>> times but only as long as <foo> is the same each time, and errors out
>> otherwise. That's rather harsh and makes it difficult for someone to
>> override a value specified earlier on the command line (say, coming
>> from a Git alias). The typical way this is handled is "last wins"
>> rather than making it an error.
> 
> Yup, the last one wins is something I would have expected.  And if
> we follow that (which is the usual pattern), I suspect that we won't
> even need the first two steps of this series?

We would need them anyway, in order to add a callback to the "command mode" option --show-current-patch.

The fact that --show-current-patch is a command mode option is also why I decided against "last one wins". I think it would be counterintuitive that

	git am --abort --show-current-patch
fails, but
	git am --show-current-patch=diff --show-current-patch=raw
succeeds.

Another possibility is to have separate options --show-current-message (for .git/rebase-apply/NNNN) and --show-current-diff (for .git/rebase-apply/patch), possibly deprecating --show-current-patch. That would have naturally rejected a command line like

	git am --show-current-message --show-current-diff

(and this one _would_ have removed the need for the first two patches in the series). However, the long common prefix would have prevented using an abbreviated option such as "--show", so I went instead for the optional string argument.

I realize now that I should have placed all this in the commit message, sorry about that.

Paolo
Previous: Junio C HamanoNext: pbonzini@redhat.com
Message 13 of 15 in “am: provide a replacement for "cat .git/rebase-apply/patch"”
  1. 0/4 am: provide a replacement for "cat .git/rebase-apply/patch"pbonzini@redhat.com, Feb 19, 2020
  2. 1/4 parse-options: convert "command mode" to a flagpbonzini@redhat.com, Feb 19, 2020
  3. Eric SunshineFeb 19, 2020
  4. Johannes SchindelinFeb 20, 2020
  5. Junio C HamanoFeb 19, 2020
  6. Paolo BonziniFeb 19, 2020
  7. 2/4 am: convert "resume" variable to a structpbonzini@redhat.com, Feb 19, 2020
  8. Junio C HamanoFeb 19, 2020
  9. Paolo BonziniFeb 19, 2020
  10. 3/4 am: support --show-current-patch=raw as a synonym for--show-current-patchpbonzini@redhat.com, Feb 19, 2020
  11. Eric SunshineFeb 19, 2020
  12. Junio C HamanoFeb 19, 2020
  13. Paolo BonziniFeb 19, 2020
  14. 4/4 am: support --show-current-patch=diff to retrieve .git/rebase-apply/patchpbonzini@redhat.com, Feb 19, 2020
  15. Eric SunshineFeb 19, 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.