git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Sebastian Schuberth <sschuberth@gmail.com>
Subject: [PATCH v2 0/3] rebase -i (reword): call the commit-msg hook again
Date: Thu, 23 Mar 2017 17:07:03 +0100 (CET)	[thread overview]
Message-ID: <cover.1490285210.git.johannes.schindelin@gmx.de> (raw)
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


  parent reply	other threads:[~2017-03-23 16:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 15:01 [PATCH 0/3] rebase -i (reword): call the commit-msg hook again Johannes Schindelin
2017-03-22 15:01 ` [PATCH 1/3] t7504: document regression: reword no longer calls commit-msg Johannes Schindelin
2017-03-22 15:18   ` Sebastian Schuberth
2017-03-22 16:09     ` Johannes Schindelin
2017-03-22 18:15       ` Junio C Hamano
2017-03-23 14:43         ` Johannes Schindelin
2017-03-23 14:55           ` Sebastian Schuberth
2017-03-23 15:52             ` Johannes Schindelin
2017-03-22 18:12     ` Junio C Hamano
2017-03-23 14:41       ` Johannes Schindelin
2017-03-22 15:01 ` [PATCH 2/3] sequencer: make commit options more extensible Johannes Schindelin
2017-03-22 18:21   ` Junio C Hamano
2017-03-23 14:39     ` Johannes Schindelin
2017-03-23 16:04   ` Junio C Hamano
2017-03-22 15:02 ` [PATCH 3/3] sequencer: allow the commit-msg hooks to run during a `reword` Johannes Schindelin
2017-03-22 18:43   ` Junio C Hamano
2017-03-23 15:49     ` Johannes Schindelin
2017-03-23 16:07 ` Johannes Schindelin [this message]
2017-03-23 16:07   ` [PATCH v2 1/3] t7504: document regression: reword no longer calls commit-msg Johannes Schindelin
2017-03-23 16:07   ` [PATCH v2 2/3] sequencer: make commit options more extensible Johannes Schindelin
2017-03-24  1:01     ` Junio C Hamano
2017-03-25  0:01       ` Johannes Schindelin
2017-03-27  0:55         ` Junio C Hamano
2017-03-27 21:03           ` Junio C Hamano
2017-03-29 12:49             ` Johannes Schindelin
2017-03-23 16:07   ` [PATCH v2 3/3] sequencer: allow the commit-msg hooks to run during a `reword` Johannes Schindelin
2017-03-23 16:51     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1490285210.git.johannes.schindelin@gmx.de \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sschuberth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).