Thread (2 messages) flat view 2 messages, 2 authors, 2026-02-13

Re: [PATCH 2/4] builtin/history: check for merges before asking for user input

From: Junio C Hamano <hidden>
Date: 2026-02-12 22:26:49

"D. Ben Knoble" [off-list ref] writes:
On Thu, Feb 12, 2026 at 7:45 AM Patrick Steinhardt [off-list ref] wrote:
quoted
The replay infrastructure is not yet capable of replaying merge commits.
Unfortunately, we only notice that we're about to replay merges after we
have already asked the user for input, so any commit message that the
user may have written will be discarded in that case.

Fix this by checking whether the revwalk contains merge commits before
we ask for user input.
Indeed, that would be irritating :)
quoted
Signed-off-by: Patrick Steinhardt <redacted>
---
 builtin/history.c         | 40 ++++++++++++++++++++++++++++++++++++++++
 t/t3451-history-reword.sh |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/builtin/history.c b/builtin/history.c
index 1de51372ea..ca0cdb6a58 100644
--- a/builtin/history.c
+++ b/builtin/history.c
@@ -177,6 +177,42 @@ static int parse_ref_action(const struct option *opt, const char *value, int uns
        return 0;
 }

+static int revwalk_contains_merges(struct repository *repo,
+                                  const struct strvec *revwalk_args)
+{
+       struct strvec args = STRVEC_INIT;
+       struct rev_info revs;
+       int ret;
+
+       for (size_t i = 0; i < revwalk_args->nr; i++)
+               strvec_push(&args, revwalk_args->v[i]);
I'm surprised we don't have anything like Rust's Vec::append or
Vec::extend_from_slice
strvec_pushv() is what you are looking for.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help