git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 3/3] commit: add --cleanup=scissors
Date: Sat, 22 Feb 2014 07:58:56 +0700	[thread overview]
Message-ID: <20140222005856.GA9231@lanh> (raw)
In-Reply-To: <1392639332-7703-4-git-send-email-pclouds@gmail.com>

On Mon, Feb 17, 2014 at 07:15:32PM +0700, Nguyễn Thái Ngọc Duy wrote:
> @@ -777,6 +778,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>  				_("Please enter the commit message for your changes."
>  				  " Lines starting\nwith '%c' will be ignored, and an empty"
>  				  " message aborts the commit.\n"), comment_line_char);
> +		else if (cleanup_mode == CLEANUP_SCISSORS)
> +			wt_status_add_cut_line(s->fp);
>  		else /* CLEANUP_SPACE, that is. */
>  			status_printf(s, GIT_COLOR_NORMAL,
>  				_("Please enter the commit message for your changes."

This cut line does not cover the merge conflict message before it. The
following patch should be squashed in to move the cut line up in that
case.

-- 8< --
diff --git a/builtin/commit.c b/builtin/commit.c
index ea2912f..1033c50 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -755,7 +755,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 	strbuf_addstr(&committer_ident, git_committer_info(IDENT_STRICT));
 	if (use_editor && include_status) {
 		char *ai_tmp, *ci_tmp;
-		if (whence != FROM_COMMIT)
+		if (whence != FROM_COMMIT) {
+			if (cleanup_mode == CLEANUP_SCISSORS)
+				wt_status_add_cut_line(s->fp);
 			status_printf_ln(s, GIT_COLOR_NORMAL,
 			    whence == FROM_MERGE
 				? _("\n"
@@ -771,6 +773,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 				git_path(whence == FROM_MERGE
 					 ? "MERGE_HEAD"
 					 : "CHERRY_PICK_HEAD"));
+		}
 
 		fprintf(s->fp, "\n");
 		if (cleanup_mode == CLEANUP_ALL)
@@ -778,7 +781,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 				_("Please enter the commit message for your changes."
 				  " Lines starting\nwith '%c' will be ignored, and an empty"
 				  " message aborts the commit.\n"), comment_line_char);
-		else if (cleanup_mode == CLEANUP_SCISSORS)
+		else if (cleanup_mode == CLEANUP_SCISSORS && whence == FROM_COMMIT)
 			wt_status_add_cut_line(s->fp);
 		else /* CLEANUP_SPACE, that is. */
 			status_printf(s, GIT_COLOR_NORMAL,
-- 8< --

  reply	other threads:[~2014-02-22  0:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-16  3:37 [PATCH 0/3] commit --cleanup=<scissors marker> Nguyễn Thái Ngọc Duy
2014-02-16  3:37 ` [PATCH 1/3] wt-status.c: make cut_lines[] const to shrink .data section a bit Nguyễn Thái Ngọc Duy
2014-02-16 16:21   ` brian m. carlson
2014-02-16  3:37 ` [PATCH 2/3] wt-status.c: move cut-line print code out to wt_status_add_cut_line Nguyễn Thái Ngọc Duy
2014-02-16  3:37 ` [PATCH 3/3] commit: add --cleanup=scissors Nguyễn Thái Ngọc Duy
2014-02-16  3:44   ` Eric Sunshine
2014-02-17 12:15 ` [PATCH v2 0/3] commit --cleanup=<scissors marker> Nguyễn Thái Ngọc Duy
2014-02-17 12:15   ` [PATCH v2 1/3] wt-status.c: make cut_line[] const to shrink .data section a bit Nguyễn Thái Ngọc Duy
2014-02-17 12:15   ` [PATCH v2 2/3] wt-status.c: move cut-line print code out to wt_status_add_cut_line Nguyễn Thái Ngọc Duy
2014-02-17 12:15   ` [PATCH v2 3/3] commit: add --cleanup=scissors Nguyễn Thái Ngọc Duy
2014-02-22  0:58     ` Duy Nguyen [this message]
2014-02-24 17:20       ` Junio C Hamano
2014-02-24 23:28         ` Duy Nguyen
2014-02-25  0:18           ` 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=20140222005856.GA9231@lanh \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).