Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: git@vger.kernel.org,  David Bimmler <david.bimmler@isovalent.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 5/5] rebase -m: fix --signoff with conflicts
Date: Thu, 18 Apr 2024 14:16:36 -0700	[thread overview]
Message-ID: <xmqq7cguqsln.fsf@gitster.g> (raw)
In-Reply-To: <4c8f8843780f3ac23262f1e45a5000d183adca6b.1713445918.git.phillip.wood@dunelm.org.uk> (Phillip Wood's message of "Thu, 18 Apr 2024 14:14:09 +0100")

Phillip Wood <phillip.wood123@gmail.com> writes:

> +	struct replay_ctx *ctx = opts->ctx;
> +
> +	/*
> +	 * Write the commit message to be used by "git rebase
> +	 * --continue". If a "fixup" or "squash" command has conflicts
> +	 * then we will have already written rebase_path_message() in
> +	 * error_failed_squash(). If an "edit" command was
> +	 * fast-forwarded then we don't have a message in ctx->message
> +	 * and rely on make_patch() to write rebase_path_message()
> +	 * instead.
> +	 */
> +	if (ctx->have_message && !file_exists(rebase_path_message()) &&
> +	    write_message(ctx->message.buf, ctx->message.len,
> +			  rebase_path_message(), 0))
> +		return error(_("could not write commit message file"));

Makes the readers wonder if there are cases where we have written to
disc, but .have_message is true and the on-disc contents and in-core
contents are different.  If a codepath that writes to the file had
the message in-core, and it needs to tweak the message (e.g., add a
sign-off trailer) before writing it out to the file but forgot to do
so, then later we have tweaked the message in-core, such a bug would
result in the necessary "tweak" we have done not appear on disc.
Optionally keeping an in-core copy of what we have on disc does not
directly reduces the possibility of introducing such a bug, and I am
wondering if we can do anything clever about it.

Thanks.

      reply	other threads:[~2024-04-18 21:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 13:14 [PATCH 0/5] rebase -m: fix --signoff with conflicts Phillip Wood
2024-04-18 13:14 ` [PATCH 1/5] sequencer: always free "struct replay_opts" Phillip Wood
2024-04-18 13:14 ` [PATCH 2/5] sequencer: start removing private fields from public API Phillip Wood
2024-04-18 20:42   ` Junio C Hamano
2024-04-18 13:14 ` [PATCH 3/5] sequencer: move current fixups to private context Phillip Wood
2024-04-18 20:48   ` Junio C Hamano
2024-04-18 13:14 ` [PATCH 4/5] sequencer: store commit message in " Phillip Wood
2024-04-18 21:03   ` Junio C Hamano
2024-04-18 13:14 ` [PATCH 5/5] rebase -m: fix --signoff with conflicts Phillip Wood
2024-04-18 21:16   ` Junio C Hamano [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

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

  git send-email \
    --in-reply-to=xmqq7cguqsln.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=david.bimmler@isovalent.com \
    --cc=git@vger.kernel.org \
    --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.
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).