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

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

From
Elijah Newren <newren@gmail.com>
Date
Aug 27, 2026, 00:24 UTC
Message-ID
<CABPp-BFwN_ek_t67V5nPruV5vL0hSzZyoy3ut3rvzNsWv2DKpw@mail.gmail.com>
In-Reply-To
<xmqqqzjkj0p2.fsf@gitster.g>
On Wed, Aug 26, 2026 at 9:39 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
>
> "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > @@ -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)
>
> > +     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.

Previous: Junio C HamanoNext: Elijah Newren via GitGitGadget
Message 7 of 43 in “commit: refuse to amend during conflict resolution”
  1. commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 26, 2026
  2. Phillip WoodAug 26, 2026
  3. Elijah NewrenAug 27, 2026
  4. Junio C HamanoAug 26, 2026
  5. Elijah NewrenAug 27, 2026
  6. Junio C HamanoAug 26, 2026
  7. Elijah NewrenAug 27, 2026
  8. 0/3 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  9. 1/3 commit: reword the empty-commit rebase errorsElijah Newren via GitGitGadget, Aug 27, 2026
  10. Phillip WoodAug 27, 2026
  11. Junio C HamanoAug 27, 2026
  12. Elijah NewrenAug 28, 2026
  13. Junio C HamanoAug 27, 2026
  14. Junio C HamanoAug 27, 2026
  15. Elijah NewrenAug 28, 2026
  16. 2/3 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  17. Phillip WoodAug 27, 2026
  18. 3/3 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Aug 27, 2026
  19. Phillip WoodAug 27, 2026
  20. Phillip WoodAug 27, 2026
  21. Elijah NewrenAug 27, 2026
  22. 0/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  23. 1/5 commit: clarify FROM_REBASE_PICK and is_from_rebase() namesElijah Newren via GitGitGadget, Aug 28, 2026
  24. Junio C HamanoAug 28, 2026
  25. Elijah NewrenAug 28, 2026
  26. 2/5 commit: allow a partial commit when a rebase pick becomes emptyElijah Newren via GitGitGadget, Aug 28, 2026
  27. Junio C HamanoAug 28, 2026
  28. 3/5 commit: reword the empty-commit rebase amend errorElijah Newren via GitGitGadget, Aug 28, 2026
  29. Junio C HamanoAug 28, 2026
  30. 4/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  31. 5/5 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Aug 28, 2026
  32. Junio C HamanoAug 28, 2026
  33. 0/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  34. 1/5 commit: clarify FROM_REBASE_PICK and is_from_rebase() namesElijah Newren via GitGitGadget, Sep 1, 2026
  35. Phillip WoodSep 2, 2026
  36. 2/5 commit: allow a partial commit when a rebase pick becomes emptyElijah Newren via GitGitGadget, Sep 1, 2026
  37. Phillip WoodSep 2, 2026
  38. 3/5 commit: reword the empty-commit rebase amend errorElijah Newren via GitGitGadget, Sep 1, 2026
  39. Phillip WoodSep 2, 2026
  40. 4/5 commit: refuse to amend during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  41. Phillip WoodSep 2, 2026
  42. 5/5 commit: refuse partial commits during conflict resolutionElijah Newren via GitGitGadget, Sep 1, 2026
  43. Phillip WoodSep 2, 2026

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.