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

[PATCH v2 0/3] rebase -i (reword): call the commit-msg hook again

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 23, 2017, 16:07 UTC
Message-ID
<cover.1490285210.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1490194846.git.johannes.schindelin@gmx.de>

It is actually not only the commit-msg, but also the prepare-commit-msg hook...

Changes since v1:
- changed `int flags` to `unsigned int flags`
- uncuddled the if...else if... construct to not mix the "goto leave"
  logic with the one adding the VERIFY_MSG flag
Johannes Schindelin (3):
  t7504: document regression: reword no longer calls commit-msg
  sequencer: make commit options more extensible
  sequencer: allow the commit-msg hooks to run during a `reword`
 sequencer.c                | 54 ++++++++++++++++++++++++++--------------------
 t/t7504-commit-msg-hook.sh | 17 +++++++++++++++
 2 files changed, 48 insertions(+), 23 deletions(-)
base-commit: afd6726309f57f532b4b989a75c1392359c611cc
Published-As: https://github.com/dscho/git/releases/tag/reword-commit-msg-hook-v2
Fetch-It-Via: git fetch https://github.com/dscho/git reword-commit-msg-hook-v2
Interdiff vs v1:
 diff --git a/sequencer.c b/sequencer.c
 index 377af91c475..bc2fe48e65c 100644
 --- a/sequencer.c
 +++ b/sequencer.c
 @@ -621,7 +621,7 @@ N_("you have staged changes in your working tree\n"
   * author metadata.
   */
  static int run_git_commit(const char *defmsg, struct replay_opts *opts,
 -			  int flags)
 +			  unsigned int flags)
  {
  	struct child_process cmd = CHILD_PROCESS_INIT;
  	const char *value;
 @@ -932,7 +932,7 @@ static void record_in_rewritten(struct object_id *oid,
  static int do_pick_commit(enum todo_command command, struct commit *commit,
  		struct replay_opts *opts, int final_fixup)
  {
 -	int flags = opts->edit ? EDIT_MSG : 0, allow = 0;
 +	unsigned int flags = opts->edit ? EDIT_MSG : 0, allow = 0;
  	const char *msg_file = opts->edit ? NULL : git_path_merge_msg();
  	unsigned char head[20];
  	struct commit *base, *next, *parent;
 @@ -995,13 +995,11 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
  			write_author_script(msg.message);
  		res = fast_forward_to(commit->object.oid.hash, head, unborn,
  			opts);
 -		if (res)
 -			goto leave;
 -		else if (command == TODO_REWORD)
 -			flags |= VERIFY_MSG;
 -		else
 +		if (res || command != TODO_REWORD)
  			goto leave;
  		flags |= EDIT_MSG | AMEND_MSG;
 +		if (command == TODO_REWORD)
 +			flags |= VERIFY_MSG;
  		msg_file = NULL;
  		goto fast_forward_edit;
  	}
 @@ -2164,7 +2162,7 @@ static int continue_single_pick(void)
  
  static int commit_staged_changes(struct replay_opts *opts)
  {
 -	int flags = ALLOW_EMPTY | EDIT_MSG;
 +	unsigned int flags = ALLOW_EMPTY | EDIT_MSG;
  
  	if (has_unstaged_changes(1))
  		return error(_("cannot rebase: You have unstaged changes."));
-- 
2.12.1.windows.1
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 18 of 27 in “rebase -i (reword): call the commit-msg hook again”
  1. 0/3 rebase -i (reword): call the commit-msg hook againJohannes Schindelin, Mar 22, 2017
  2. 2/3 sequencer: make commit options more extensibleJohannes Schindelin, Mar 22, 2017
  3. Junio C HamanoMar 22, 2017
  4. Johannes SchindelinMar 23, 2017
  5. Junio C HamanoMar 23, 2017
  6. 1/3 t7504: document regression: reword no longer calls commit-msgJohannes Schindelin, Mar 22, 2017
  7. Sebastian SchuberthMar 22, 2017
  8. Johannes SchindelinMar 22, 2017
  9. Junio C HamanoMar 22, 2017
  10. Johannes SchindelinMar 23, 2017
  11. Sebastian SchuberthMar 23, 2017
  12. Johannes SchindelinMar 23, 2017
  13. Junio C HamanoMar 22, 2017
  14. Johannes SchindelinMar 23, 2017
  15. 3/3 sequencer: allow the commit-msg hooks to run during a `reword`Johannes Schindelin, Mar 22, 2017
  16. Junio C HamanoMar 22, 2017
  17. Johannes SchindelinMar 23, 2017
  18. 0/3 rebase -i (reword): call the commit-msg hook againJohannes Schindelin, Mar 23, 2017
  19. 1/3 t7504: document regression: reword no longer calls commit-msgJohannes Schindelin, Mar 23, 2017
  20. 2/3 sequencer: make commit options more extensibleJohannes Schindelin, Mar 23, 2017
  21. Junio C HamanoMar 24, 2017
  22. Johannes SchindelinMar 25, 2017
  23. Junio C HamanoMar 27, 2017
  24. Junio C HamanoMar 27, 2017
  25. Johannes SchindelinMar 29, 2017
  26. 3/3 sequencer: allow the commit-msg hooks to run during a `reword`Johannes Schindelin, Mar 23, 2017
  27. Junio C HamanoMar 23, 2017

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.