git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Junio C Hamano <gitster@pobox.com>,
	Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>, bfields@redhat.com
Subject: Re: [PATCH 3/4] am: support --show-current-patch=raw as a synonym for--show-current-patch
Date: Wed, 19 Feb 2020 21:53:37 +0100	[thread overview]
Message-ID: <217229b8-3a72-55fb-71c6-8ba8ae3ceb0b@redhat.com> (raw)
In-Reply-To: <xmqqmu9ee3hc.fsf@gitster-ct.c.googlers.com>

On 19/02/20 21:17, Junio C Hamano wrote:
>>> +       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


  reply	other threads:[~2020-02-19 20:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 16:13 [PATCH 0/4] am: provide a replacement for "cat .git/rebase-apply/patch" pbonzini
2020-02-19 16:13 ` [PATCH 1/4] parse-options: convert "command mode" to a flag pbonzini
2020-02-19 19:11   ` Eric Sunshine
2020-02-20 16:00     ` Johannes Schindelin
2020-02-19 19:15   ` Junio C Hamano
2020-02-19 21:05     ` Paolo Bonzini
2020-02-19 16:13 ` [PATCH 2/4] am: convert "resume" variable to a struct pbonzini
2020-02-19 19:19   ` Junio C Hamano
2020-02-19 21:05     ` Paolo Bonzini
2020-02-19 16:13 ` [PATCH 3/4] am: support --show-current-patch=raw as a synonym for--show-current-patch pbonzini
2020-02-19 19:34   ` Eric Sunshine
2020-02-19 20:17     ` Junio C Hamano
2020-02-19 20:53       ` Paolo Bonzini [this message]
2020-02-19 16:13 ` [PATCH 4/4] am: support --show-current-patch=diff to retrieve .git/rebase-apply/patch pbonzini
2020-02-19 19:49   ` Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=217229b8-3a72-55fb-71c6-8ba8ae3ceb0b@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bfields@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).