Thread (43 messages) flat view 43 messages, 4 authors, 3d ago

Re: [PATCH] commit: refuse to amend during conflict resolution

From: Elijah Newren <hidden>
Date: 2026-08-27 00:24:54

On Wed, Aug 26, 2026 at 9:39 AM Junio C Hamano [off-list ref] wrote:
"Elijah Newren via GitGitGadget" [off-list ref] writes:
quoted
@@ -1336,6 +1337,46 @@ static int parse_and_validate_options(int argc, const char *argv[],
              else if (whence == FROM_REBASE_PICK)
                      die(_("You are in the middle of a rebase -- cannot amend."));
      }
Let's make a mental note that the function receives these parameters:

static int parse_and_validate_options(int argc, const char *argv[],
                                      const struct option *options,
                                      const char * const usage[],
                                      const char *prefix,
                                      struct commit *current_head,
                                      struct wt_status *s)
quoted
+     if (amend && whence == FROM_COMMIT) {
+             char *applying, *apply_dir, *stopped_sha, *amend_marker;
+             int in_am, conflicted_stop;
+
+             /* Check middle of revert */
+             if (refs_ref_exists(get_main_ref_store(the_repository),
+                                 "REVERT_HEAD"))
+                     die(_("You are in the middle of a revert -- cannot amend."));
"the_repository" can become "s->repo".  The same comment for other
checks in this block.
Good catch; fixed in v2...although the partial commit callsite didn't
have a handy repo that I could spot, so I still used the_repository on
that one, but I used s->repo as you suggested for the amend site.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help