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

Re: [PATCH v2 3/3] commit: add --cleanup=scissors

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 22, 2014, 00:58 UTC
Message-ID
<20140222005856.GA9231@lanh>
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:
Show 9 quoted lines
> @@ -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< --
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 11 of 14 in “commit --cleanup=<scissors marker>”
  1. 0/3 commit --cleanup=<scissors marker>Nguyễn Thái Ngọc Duy, Feb 16, 2014
  2. 1/3 wt-status.c: make cut_lines[] const to shrink .data section a bitNguyễn Thái Ngọc Duy, Feb 16, 2014
  3. brian m. carlsonFeb 16, 2014
  4. 2/3 wt-status.c: move cut-line print code out to wt_status_add_cut_lineNguyễn Thái Ngọc Duy, Feb 16, 2014
  5. 3/3 commit: add --cleanup=scissorsNguyễn Thái Ngọc Duy, Feb 16, 2014
  6. Eric SunshineFeb 16, 2014
  7. 0/3 commit --cleanup=<scissors marker>Nguyễn Thái Ngọc Duy, Feb 17, 2014
  8. 1/3 wt-status.c: make cut_line[] const to shrink .data section a bitNguyễn Thái Ngọc Duy, Feb 17, 2014
  9. 2/3 wt-status.c: move cut-line print code out to wt_status_add_cut_lineNguyễn Thái Ngọc Duy, Feb 17, 2014
  10. 3/3 commit: add --cleanup=scissorsNguyễn Thái Ngọc Duy, Feb 17, 2014
  11. Duy NguyenFeb 22, 2014
  12. Junio C HamanoFeb 24, 2014
  13. Duy NguyenFeb 24, 2014
  14. Junio C HamanoFeb 25, 2014

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.