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

Re: [PATCH 5/5] rebase -m: fix --signoff with conflicts

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 18, 2024, 21:16 UTC
Message-ID
<xmqq7cguqsln.fsf@gitster.g>
In-Reply-To
<4c8f8843780f3ac23262f1e45a5000d183adca6b.1713445918.git.phillip.wood@dunelm.org.uk>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 15 quoted lines
> +	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.
Previous: Phillip Wood
Message 10 of 10 in “rebase -m: fix --signoff with conflicts”
  1. 0/5 rebase -m: fix --signoff with conflictsPhillip Wood, Apr 18, 2024
  2. 1/5 sequencer: always free "struct replay_opts"Phillip Wood, Apr 18, 2024
  3. 2/5 sequencer: start removing private fields from public APIPhillip Wood, Apr 18, 2024
  4. Junio C HamanoApr 18, 2024
  5. 3/5 sequencer: move current fixups to private contextPhillip Wood, Apr 18, 2024
  6. Junio C HamanoApr 18, 2024
  7. 4/5 sequencer: store commit message in private contextPhillip Wood, Apr 18, 2024
  8. Junio C HamanoApr 18, 2024
  9. 5/5 rebase -m: fix --signoff with conflictsPhillip Wood, Apr 18, 2024
  10. Junio C HamanoApr 18, 2024

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.