From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Philip Oakley <philipoakley@iee.email>,
Elijah Newren <newren@gmail.com>,
Phillip Wood <phillip.wood123@gmail.com>,
Elijah Newren <newren@gmail.com>,
Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v3] sequencer: fix edit handling for cherry-pick and revert messages
Date: Wed, 31 Mar 2021 16:38:59 +0200 (CEST) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.2103311638280.52@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <pull.988.v3.git.git.1617173541301.gitgitgadget@gmail.com>
Hi Elijah,
On Wed, 31 Mar 2021, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail.com>
>
> save_opts() should save any non-default values. It was intended to do
> this, but since most options in struct replay_opts default to 0, it only
> saved non-zero values. Unfortunately, this does not always work for
> options.edit. Roughly speaking, options.edit had a default value of 0
> for cherry-pick but a default value of 1 for revert. Make save_opts()
> record a value whenever it differs from the default.
>
> options.edit was also overly simplistic; we had more than two cases.
> The behavior that previously existed was as follows:
>
> Non-conflict commits Right after Conflict
> revert Edit iff isatty(0) Edit (ignore isatty(0))
> cherry-pick No edit See above
> Specify --edit Edit (ignore isatty(0)) See above
> Specify --no-edit (*) See above
>
> (*) Before stopping for conflicts, No edit is the behavior. After
> stopping for conflicts, the --no-edit flag is not saved so see
> the first two rows.
>
> However, the expected behavior is:
>
> Non-conflict commits Right after Conflict
> revert Edit iff isatty(0) Edit iff isatty(0)
> cherry-pick No edit Edit iff isatty(0)
> Specify --edit Edit (ignore isatty(0)) Edit (ignore isatty(0))
> Specify --no-edit No edit No edit
>
> In order to get the expected behavior, we need to change options.edit
> to a tri-state: unspecified, false, or true. When specified, we follow
> what it says. When unspecified, we need to check whether the current
> commit being created is resolving a conflict as well as consulting
> options.action and isatty(0). While at it, add a should_edit() utility
> function that compresses options.edit down to a boolean based on the
> additional information for the non-conflict case.
>
> continue_single_pick() is the function responsible for resuming after
> conflict cases, regardless of whether there is one commit being picked
> or many. Make this function stop assuming edit behavior in all cases,
> so that it can correctly handle !isatty(0) and specific requests to not
> edit the commit message.
>
> Reported-by: Renato Botelho <garga@freebsd.org>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
> sequencer: fix edit handling for cherry-pick and revert messages
>
> Changes since v2:
>
> * Changed to use <0 for unspecified (instead of == -1), >0 for true
> (instead of == 1).
> * Removed assert() statement.
> * Removed unnecessary "want_edit" local variable
>
> Reported-by: Renato Botelho garga@freebsd.org Signed-off-by: Elijah
> Newren newren@gmail.com
Looks good, thank you!
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Thanks,
Dscho
prev parent reply other threads:[~2021-03-31 14:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 7:16 [PATCH] sequencer: fix edit handling for cherry-pick and revert messages Elijah Newren via GitGitGadget
2021-03-26 12:27 ` Philip Oakley
2021-03-26 15:12 ` Elijah Newren
2021-03-28 1:30 ` Junio C Hamano
2021-03-29 9:23 ` Phillip Wood
2021-03-29 20:52 ` Junio C Hamano
2021-03-29 21:25 ` Elijah Newren
2021-03-30 2:09 ` [PATCH v2] " Elijah Newren via GitGitGadget
2021-03-30 10:13 ` Johannes Schindelin
2021-03-30 18:47 ` Junio C Hamano
2021-03-30 20:16 ` Elijah Newren
2021-03-31 17:36 ` Ævar Arnfjörð Bjarmason
2021-03-31 17:52 ` Elijah Newren
2021-03-31 18:01 ` Junio C Hamano
2021-04-01 16:31 ` Elijah Newren
2021-03-30 19:37 ` Elijah Newren
2021-03-31 13:48 ` unifying sequencer's options persisting, was " Johannes Schindelin
2021-04-02 11:28 ` Phillip Wood
2021-04-02 13:10 ` Phillip Wood
2021-04-02 21:01 ` Junio C Hamano
2021-04-02 22:18 ` Elijah Newren
2021-04-02 22:27 ` Junio C Hamano
2021-04-08 2:40 ` Johannes Schindelin
2021-04-08 17:45 ` Junio C Hamano
2021-04-08 19:58 ` Christian Couder
2021-04-09 13:53 ` Johannes Schindelin
2021-03-31 6:52 ` [PATCH v3] " Elijah Newren via GitGitGadget
2021-03-31 14:38 ` Johannes Schindelin [this message]
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=nycvar.QRO.7.76.6.2103311638280.52@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
--cc=philipoakley@iee.email \
--cc=phillip.wood123@gmail.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).