From: Patrick Monette <pmonette@google.com>
To: git@vger.kernel.org
Cc: newren@gmail.com, ps@pks.im, toon@iotcl.com,
Patrick Monette <pmonette@google.com>
Subject: [PATCH 1/2] replay: handle failure to create commits
Date: Fri, 25 Sep 2026 16:53:47 -0400 [thread overview]
Message-ID: <20260925205348.1210154-2-pmonette@google.com> (raw)
In-Reply-To: <20260925205348.1210154-1-pmonette@google.com>
When pick_regular_commit() returns NULL, the caller relies on
`result->clean` to figure out what happened. 1 means success, 0 means a
conflict, and a negative value means an error.
Right now, if the commit creation fails, `result->clean` stays at 1. The
caller doesn't expect the combination of NULL + clean == 1, so it breaks
out of the loop, but the rest of the function treats this as a success.
The next commit will add a failure mode (signing) to the commit
creation, so this needs to be handled correctly. Set `result->clean`
to -1 when the commit creation fails.
Signed-off-by: Patrick Monette <pmonette@google.com>
---
replay.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/replay.c b/replay.c
index f415103023..ad87863565 100644
--- a/replay.c
+++ b/replay.c
@@ -291,6 +291,7 @@ static struct commit *pick_regular_commit(struct repository *repo,
enum replay_empty_commit_action empty)
{
struct tree *pickme_tree, *base_tree, *replayed_base_tree;
+ struct commit *new_commit;
if (pickme->parents)
base_tree = repo_get_commit_tree(repo, pickme->parents->item);
@@ -361,7 +362,11 @@ static struct commit *pick_regular_commit(struct repository *repo,
}
}
- return create_commit(repo, result->tree, pickme, replayed_base, mode);
+ new_commit = create_commit(repo, result->tree, pickme, replayed_base,
+ mode);
+ if (!new_commit)
+ result->clean = -1;
+ return new_commit;
}
void replay_result_release(struct replay_result *result)
--
2.56.0.rc1.315.gc6ed9934b7-goog
next prev parent reply other threads:[~2026-09-25 20:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 20:53 [PATCH 0/2] replay: add signing support Patrick Monette
2026-09-25 20:53 ` Patrick Monette [this message]
2026-09-28 7:41 ` [PATCH 1/2] replay: handle failure to create commits Patrick Steinhardt
2026-09-25 20:53 ` [PATCH 2/2] replay: add the -S option Patrick Monette
2026-09-28 7:41 ` Patrick Steinhardt
2026-10-02 21:23 ` Junio C Hamano
2026-09-28 7:41 ` [PATCH 0/2] replay: add signing support Patrick Steinhardt
2026-09-28 15:23 ` Junio C Hamano
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=20260925205348.1210154-2-pmonette@google.com \
--to=pmonette@google.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=ps@pks.im \
--cc=toon@iotcl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.