Skip to content

fix hunk editing with 'commit -p -m'

Benoit Pierre git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 28 repliesIn review
  2. v16 patches 9 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7merge hook tests: fix missing '&&' in testt/t7505-prepare-commit-msg-hook.sh+1 -10 replies
1/7merge hook tests: fix missing '&&' in testt/t7505-prepare-commit-msg-hook.sh+1 -10 replies
1/7merge hook tests: fix missing '&&' in testt/t7505-prepare-commit-msg-hook.sh+1 -11 reply
2/7merge hook tests: use 'test_must_fail' instead of '!'t/t7505-prepare-commit-msg-hook.sh+2 -20 replies
2/7merge hook tests: use 'test_must_fail' instead of '!'t/t7505-prepare-commit-msg-hook.sh+2 -20 replies
2/7merge hook tests: use 'test_must_fail' instead of '!'t/t7505-prepare-commit-msg-hook.sh+2 -20 replies
3/7test patch hunk editing with "commit -p -m"t/t7513-commit_-p_-m_hunk_edit.sh+34 -07 replies
3/7test patch hunk editing with "commit -p -m"t/t7513-commit-patch.sh+32 -08 replies
3/7test patch hunk editing with "commit -p -m"t/t7514-commit-patch.sh+34 -00 replies
4/7commit: fix patch hunk editing with "commit -p -m"builtin/checkout.c builtin/clone.c builtin/commit.c +6 more+79 -316 replies
4/7commit: fix patch hunk editing with "commit -p -m"builtin/checkout.c builtin/clone.c builtin/commit.c +6 more+80 -320 replies
4/7commit: fix patch hunk editing with "commit -p -m"builtin/checkout.c builtin/clone.c builtin/commit.c +6 more+80 -322 replies
5/7merge: fix GIT_EDITOR override for commit hookbuiltin/merge.c+1 -10 replies
5/7merge: fix GIT_EDITOR override for commit hookbuiltin/merge.c+1 -10 replies
5/7merge: fix GIT_EDITOR override for commit hookbuiltin/merge.c+1 -10 replies
6/7merge hook tests: fix and update testst/t7505-prepare-commit-msg-hook.sh+21 -61 reply
6/7merge hook tests: fix and update testst/t7505-prepare-commit-msg-hook.sh+21 -60 replies
6/7merge hook tests: fix and update testst/t7505-prepare-commit-msg-hook.sh+21 -60 replies
7/7run-command: mark run_hook_with_custom_index as deprecatedrun-command.h+1 -02 replies
7/7run-command: mark run_hook_with_custom_index as deprecatedrun-command.h+1 -00 replies
7/7run-command: mark run_hook_with_custom_index as deprecatedrun-command.h+1 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH V2 0/7] fix hunk editing with 'commit -p -m'

This patch fixes the fact that hunk editing with 'commit -p -m' does not work:
GIT_EDITOR is set to ':' to indicate to hooks that no editor will be launched, which result in the 'hunk edit' option not launching the editor (and selecting the whole hunk).

The fix consists in deferring the GIT_EDITOR override to the hook subprocess, like it's already done for GIT_INDEX_FILE:
- rename 'run_hook' to 'run_hook_le' and change the first parameter to the environment to set
- add a 'run_hook_ve' variant that take a va_list
- add a new 'run_commit_hook' helper (to set both GIT_EDITOR and GIT_INDEX_FILE)
- the old 'run_hook' functionality is available as 'run_hook_with_custom_index' (and marked as deprecated in the last optional patch of this series)

N.B.: the merge builtin 'prepare-commit-msg' hook handling has also been updated to be consistent; i.e. GIT_EDITOR will not be set to ':' if the '--edit' option is used.

Benoit Pierre (7):
merge hook tests: fix missing '&&' in test
merge hook tests: use 'test_must_fail' instead of '!' test patch hunk editing with "commit -p -m"
commit: fix patch hunk editing with "commit -p -m"
merge: fix GIT_EDITOR override for commit hook merge hook tests: fix and update tests
run-command: mark run_hook_with_custom_index as deprecated

 builtin/checkout.c                 |  8 +++----
 builtin/clone.c                    |  4 ++--
 builtin/commit.c                   | 35 ++++++++++++++++++++++++------
 builtin/gc.c                       |  2 +-
 builtin/merge.c                    |  6 +++---
 commit.h                           |  3 +++
 run-command.c                      | 44 +++++++++++++++++++++++++++-----------
 run-command.h                      |  7 +++++-
 t/t7505-prepare-commit-msg-hook.sh | 33 ++++++++++++++++++++--------
 t/t7513-commit_-p_-m_hunk_edit.sh  | 34 +++++++++++++++++++++++++++++
 10 files changed, 137 insertions(+), 39 deletions(-)
 create mode 100755 t/t7513-commit_-p_-m_hunk_edit.sh
Signature · 1 line
1.9.0