From: Charvi Mendiratta <charvi077@gmail.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: Taylor Blau <me@ttaylorr.com>, git <git@vger.kernel.org>,
Christian Couder <christian.couder@gmail.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [RFC PATCH 1/9] rebase -i: only write fixup-message when it's needed
Date: Fri, 15 Jan 2021 14:08:37 +0530 [thread overview]
Message-ID: <CAPSFM5eBCVD9sx-AkA6Zr-PAq3JgTftcf2UhZBcBmK_00ff1+Q@mail.gmail.com> (raw)
In-Reply-To: <ac1691d6-e13e-2c04-b105-73a0645f4883@gmail.com>
On Thu, 14 Jan 2021 at 16:16, Phillip Wood <phillip.wood123@gmail.com> wrote:
>
> Hi Taylor and Charvi
>
> On 14/01/2021 08:12, Charvi Mendiratta wrote:
> > On Thu, 14 Jan 2021 at 00:13, Taylor Blau <me@ttaylorr.com> wrote:
> >>
> >> On Fri, Jan 08, 2021 at 02:53:39PM +0530, Charvi Mendiratta wrote:
> >>> From: Phillip Wood <phillip.wood@dunelm.org.uk>
> >>>
> >>> The file "$GIT_DIR/rebase-merge/fixup-message" is only used for fixup
> >>> commands, there's no point in writing it for squash commands as it is
> >>> immediately deleted.
> >>>
> >>> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> >>> Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
> >>> ---
> >>> sequencer.c | 12 +++++++-----
> >>> 1 file changed, 7 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/sequencer.c b/sequencer.c
> >>> index 8909a46770..f888a7ed3b 100644
> >>> --- a/sequencer.c
> >>> +++ b/sequencer.c
> >>> @@ -1757,11 +1757,13 @@ static int update_squash_messages(struct repository *r,
> >>> return error(_("could not read HEAD's commit message"));
> >>>
> >>> find_commit_subject(head_message, &body);
> >>> - if (write_message(body, strlen(body),
> >>> - rebase_path_fixup_msg(), 0)) {
> >>> - unuse_commit_buffer(head_commit, head_message);
> >>> - return error(_("cannot write '%s'"),
> >>> - rebase_path_fixup_msg());
> >>> + if (command == TODO_FIXUP) {
> >>> + if (write_message(body, strlen(body),
> >>> + rebase_path_fixup_msg(), 0)) {
> >>> + unuse_commit_buffer(head_commit, head_message);
> >>> + return error(_("cannot write '%s'"),
> >>> + rebase_path_fixup_msg());
> >>> + }
> >>
> >> I'm nit-picking here, but would this be clearer instead as:
> >>
> >> if (command == TODO_FIXUP && write_message(...) < 0) {
> >> unuse_commit_buffer(...);
> >> // ...
> >> }
> >>
> >> There are two changes there. One is two squash the two if-statements
> >> together, and the latter is to add a check that 'write_message()'
> >> returns an error. This explicit '< 0' checking was discussed recently in
> >> another thread[1], and I think makes the conditional here read more
> >> clearly.
>
> I don't feel that strongly but the addition of '< 0' feels like it is
> adding an unrelated change to this commit. It also leaves a code base
> where most callers of `write_message()` do not check the sign of the
> return value but a couple do (there appears to be one that checks the
> sign already and a couple that completely ignore the return value). If
> we want to standardize on always checking the sign of the return value
> of functions when checking for errors even when they never return a
> positive value then I think someone in favor of that change should
> propose a patch to the coding guidelines so it is clear what our policy
> is. When I see a '< 0`' check I tend to think the positive value has a
> non-error meaning.
>
Okay, I looked into the write_message(...) and agree that it does not return
a positive value and only returns non-zero for error case and zero for
success. So, for this patch maybe we can ignore checking '< 0' here and
later add another patch to make this function follow the convention of
"negative is error".
Thanks and Regards,
Charvi
> Best Wishes
>
> Phillip
>
> > Okay, I got this and will change it.
> >
> > Thanks and Regards,
> > Charvi
> >
> >> Thanks,
> >> Taylor
> >>
> >> [1]: https://lore.kernel.org/git/xmqqlfcz8ggj.fsf@gitster.c.googlers.com/
>
next prev parent reply other threads:[~2021-01-15 8:42 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 9:23 [RFC PATCH 0/9][Outreachy] rebase -i: add options to fixup command Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 1/9] rebase -i: only write fixup-message when it's needed Charvi Mendiratta
2021-01-13 18:43 ` Taylor Blau
2021-01-14 8:12 ` Charvi Mendiratta
2021-01-14 10:46 ` Phillip Wood
2021-01-15 8:38 ` Charvi Mendiratta [this message]
2021-01-15 17:22 ` Junio C Hamano
2021-01-16 4:49 ` Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 2/9] sequencer: factor out code to append squash message Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 3/9] rebase -i: comment out squash!/fixup! subjects from " Charvi Mendiratta
2021-01-13 19:01 ` Taylor Blau
2021-01-14 8:27 ` Charvi Mendiratta
2021-01-14 10:29 ` Phillip Wood
2021-01-15 8:35 ` Charvi Mendiratta
2021-01-15 8:44 ` Christian Couder
2021-01-15 11:12 ` Charvi Mendiratta
2021-01-17 3:39 ` Charvi Mendiratta
2021-01-18 18:29 ` Phillip Wood
2021-01-19 4:08 ` Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 4/9] sequencer: pass todo_item to do_pick_commit() Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 5/9] sequencer: use const variable for commit message comments Charvi Mendiratta
2021-01-13 19:14 ` Taylor Blau
2021-01-13 20:37 ` Junio C Hamano
2021-01-14 7:40 ` Christian Couder
2021-01-14 8:57 ` Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 6/9] rebase -i: add fixup [-C | -c] command Charvi Mendiratta
2021-01-14 9:23 ` Christian Couder
2021-01-14 9:45 ` Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 7/9] t3437: test script for fixup [-C|-c] options in interactive rebase Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 8/9] rebase -i: teach --autosquash to work with amend! Charvi Mendiratta
2021-01-08 9:23 ` [RFC PATCH 9/9] doc/git-rebase: add documentation for fixup [-C|-c] options Charvi Mendiratta
2021-01-19 7:40 ` [PATCH v2 0/9][Outreachy] rebase -i: add options to fixup command Charvi Mendiratta
2021-01-24 17:03 ` [PATCH v3 " Charvi Mendiratta
2021-01-24 17:03 ` [PATCH v3 1/9] rebase -i: only write fixup-message when it's needed Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 2/9] sequencer: factor out code to append squash message Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 3/9] rebase -i: comment out squash!/fixup! subjects from " Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 4/9] sequencer: pass todo_item to do_pick_commit() Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 5/9] sequencer: use const variable for commit message comments Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 6/9] rebase -i: add fixup [-C | -c] command Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 7/9] t3437: test script for fixup [-C|-c] options in interactive rebase Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 8/9] rebase -i: teach --autosquash to work with amend! Charvi Mendiratta
2021-01-24 17:04 ` [PATCH v3 9/9] doc/git-rebase: add documentation for fixup [-C|-c] options Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 0/9][Outreachy] rebase -i: add options to fixup command Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 1/9] rebase -i: only write fixup-message when it's needed Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 2/9] sequencer: factor out code to append squash message Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 3/9] rebase -i: comment out squash!/fixup! subjects from " Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 4/9] sequencer: pass todo_item to do_pick_commit() Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 5/9] sequencer: use const variable for commit message comments Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 6/9] rebase -i: add fixup [-C | -c] command Charvi Mendiratta
2021-02-02 0:47 ` Eric Sunshine
2021-02-02 15:29 ` Charvi Mendiratta
2021-02-03 5:05 ` Eric Sunshine
2021-02-04 0:00 ` Charvi Mendiratta
2021-02-04 0:14 ` Eric Sunshine
2021-01-29 18:20 ` [PATCH v4 7/9] t3437: test script for fixup [-C|-c] options in interactive rebase Charvi Mendiratta
2021-02-02 2:01 ` Eric Sunshine
2021-02-02 10:02 ` Christian Couder
2021-02-02 15:31 ` Charvi Mendiratta
2021-02-03 5:44 ` Eric Sunshine
2021-02-04 0:01 ` Charvi Mendiratta
2021-02-04 10:46 ` Phillip Wood
2021-02-04 16:14 ` Eric Sunshine
2021-02-04 19:12 ` Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 8/9] rebase -i: teach --autosquash to work with amend! Charvi Mendiratta
2021-02-02 3:20 ` Eric Sunshine
2021-02-02 15:29 ` Charvi Mendiratta
2021-01-29 18:20 ` [PATCH v4 9/9] doc/git-rebase: add documentation for fixup [-C|-c] options Charvi Mendiratta
2021-02-02 3:23 ` Eric Sunshine
2021-02-02 14:12 ` Marc Branchaud
2021-02-02 15:30 ` Charvi Mendiratta
2021-02-04 19:04 ` [PATCH v5 0/8][Outreachy] rebase -i: add options to fixup command Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 1/8] rebase -i: only write fixup-message when it's needed Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 2/8] sequencer: factor out code to append squash message Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 3/8] rebase -i: comment out squash!/fixup! subjects from " Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 4/8] sequencer: pass todo_item to do_pick_commit() Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 5/8] sequencer: use const variable for commit message comments Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 6/8] rebase -i: add fixup [-C | -c] command Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 7/8] t3437: test script for fixup [-C|-c] options in interactive rebase Charvi Mendiratta
2021-02-04 19:05 ` [PATCH v5 8/8] doc/git-rebase: add documentation for fixup [-C|-c] options Charvi Mendiratta
2021-02-05 7:30 ` [PATCH v5 0/8][Outreachy] rebase -i: add options to fixup command Eric Sunshine
2021-02-05 9:42 ` Charvi Mendiratta
2021-02-05 18:25 ` Christian Couder
2021-02-05 18:56 ` Eric Sunshine
2021-02-06 5:36 ` Charvi Mendiratta
2021-02-05 19:13 ` Junio C Hamano
2021-02-06 5:37 ` Charvi Mendiratta
2021-01-19 7:40 ` [PATCH v2 1/9] rebase -i: only write fixup-message when it's needed Charvi Mendiratta
2021-01-19 7:40 ` [PATCH v2 2/9] sequencer: factor out code to append squash message Charvi Mendiratta
2021-01-19 7:40 ` [PATCH v2 3/9] rebase -i: comment out squash!/fixup! subjects from " Charvi Mendiratta
2021-01-21 1:38 ` Junio C Hamano
2021-01-21 14:02 ` Charvi Mendiratta
2021-01-21 15:21 ` Christian Couder
2021-01-21 16:58 ` Phillip Wood
2021-01-21 20:56 ` Junio C Hamano
2021-01-22 19:41 ` Charvi Mendiratta
2021-01-22 19:41 ` Charvi Mendiratta
2021-01-19 7:40 ` [PATCH v2 4/9] sequencer: pass todo_item to do_pick_commit() Charvi Mendiratta
2021-01-19 7:41 ` [PATCH v2 5/9] sequencer: use const variable for commit message comments Charvi Mendiratta
2021-01-19 7:41 ` [PATCH v2 6/9] rebase -i: add fixup [-C | -c] command Charvi Mendiratta
2021-01-19 7:41 ` [PATCH v2 7/9] t3437: test script for fixup [-C|-c] options in interactive rebase Charvi Mendiratta
2021-01-19 7:41 ` [PATCH v2 8/9] rebase -i: teach --autosquash to work with amend! Charvi Mendiratta
2021-01-19 7:41 ` [PATCH v2 9/9] doc/git-rebase: add documentation for fixup [-C|-c] options Charvi Mendiratta
2021-01-19 14:37 ` Marc Branchaud
2021-01-19 17:13 ` Charvi Mendiratta
2021-01-19 22:05 ` Marc Branchaud
2021-01-20 7:10 ` Charvi Mendiratta
2021-01-20 11:04 ` Phillip Wood
2021-01-20 12:31 ` Charvi Mendiratta
2021-01-20 14:29 ` Phillip Wood
2021-01-20 16:09 ` Charvi Mendiratta
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=CAPSFM5eBCVD9sx-AkA6Zr-PAq3JgTftcf2UhZBcBmK_00ff1+Q@mail.gmail.com \
--to=charvi077@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=phillip.wood123@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
/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).