Skip to content

pr-git-2389/newren/refuse-amend-during-conflicts-v2

tagged this 27 Aug 01:02
Both git commit --amend and a partial commit (git commit <paths>) are
foot-guns while the user is in the middle of an operation that resolves
conflicts on top of HEAD: recording a conflict resolution is about capturing
the state of the whole tree as a new commit, not about rewriting HEAD or
committing a subset of paths.

Historically we only rejected these during a merge or a cherry-pick or when
resolving an empty pick during a rebase. The same hazard exists for am,
revert, and rebase conflict stops, none of which were covered. This series
extends the refusal to all of them.

The three patches:

 1. reword the two pre-existing "empty commit" rebase messages, which were
    misleadingly generic
 2. refuse git commit --amend during these additional operations
 3. refuse partial commits during the same operations.

Elijah Newren (3):
  commit: reword the empty-commit rebase errors
  commit: refuse to amend during conflict resolution
  commit: refuse partial commits during conflict resolution

 builtin/commit.c                |  51 +++++++++----
 sequencer.c                     |  65 +++++++++++++++++
 sequencer.h                     |  24 ++++++
 t/t3404-rebase-interactive.sh   | 125 +++++++++++++++++++++++++++++++-
 t/t3507-cherry-pick-conflict.sh |  22 ++++++
 t/t4151-am-abort.sh             |  22 ++++++
 6 files changed, 293 insertions(+), 16 deletions(-)

base-commit: 2c3adbb2c475981e340c79fdc5e7f4f9b5d9054e

Submitted-As: https://lore.kernel.org/git/pull.2389.v2.git.git.1787792534.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2389.git.git.1787721681893.gitgitgadget@gmail.com
Assets 2
Loading