pr-git-2389/newren/refuse-amend-during-conflicts-v3
tagged this
28 Aug 07:44
Changes since v2:
* Two new preparatory patches:
* Rename FROM_REBASE_PICK and is_from_rebase() to point out they are
about empty commits
* Allow a partial commit when a rebase pick becomes empty
* Tweaked the error message for attempted amend on now-dropped empty commit
(suggestions for further improvements welcome)
* Used the path accessor functions within sequencer.c to simplify the new
helper function
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 (5):
commit: clarify FROM_REBASE_PICK and is_from_rebase() names
commit: allow a partial commit when a rebase pick becomes empty
commit: reword the empty-commit rebase amend error
commit: refuse to amend during conflict resolution
commit: refuse partial commits during conflict resolution
builtin/commit.c | 65 +++++++++++-----
sequencer.c | 59 ++++++++++++++-
sequencer.h | 24 ++++++
t/t3404-rebase-interactive.sh | 128 +++++++++++++++++++++++++++++++-
t/t3507-cherry-pick-conflict.sh | 22 ++++++
t/t4151-am-abort.sh | 22 ++++++
wt-status.h | 6 +-
7 files changed, 299 insertions(+), 27 deletions(-)
base-commit: 2c3adbb2c475981e340c79fdc5e7f4f9b5d9054e
Submitted-As: https://lore.kernel.org/git/pull.2389.v3.git.git.1787903085.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2389.git.git.1787721681893.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2389.v2.git.git.1787792534.gitgitgadget@gmail.com