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

[PATCH v2 2/3] wt-status.c: move cut-line print code out to wt_status_add_cut_line

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Feb 17, 2014, 12:15 UTC
Message-ID
<1392639332-7703-3-git-send-email-pclouds@gmail.com>
In-Reply-To
<1392639332-7703-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 wt-status.c | 19 ++++++++++++-------
 wt-status.h |  1 +
 2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 65e35c3..ed31b6a 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -808,6 +808,17 @@ void wt_status_truncate_message_at_cut_line(struct strbuf *buf)
 	strbuf_release(&pattern);
 }
 
+void wt_status_add_cut_line(FILE *fp)
+{
+	const char *explanation = _("Do not touch the line above.\nEverything below will be removed.");
+	struct strbuf buf = STRBUF_INIT;
+
+	fprintf(fp, "%c %s", comment_line_char, cut_line);
+	strbuf_add_commented_lines(&buf, explanation, strlen(explanation));
+	fputs(buf.buf, fp);
+	strbuf_release(&buf);
+}
+
 static void wt_status_print_verbose(struct wt_status *s)
 {
 	struct rev_info rev;
@@ -833,14 +844,8 @@ static void wt_status_print_verbose(struct wt_status *s)
 	 * diff before committing.
 	 */
 	if (s->fp != stdout) {
-		const char *explanation = _("Do not touch the line above.\nEverything below will be removed.");
-		struct strbuf buf = STRBUF_INIT;
-
 		rev.diffopt.use_color = 0;
-		fprintf(s->fp, "%c %s", comment_line_char, cut_line);
-		strbuf_add_commented_lines(&buf, explanation, strlen(explanation));
-		fputs(buf.buf, s->fp);
-		strbuf_release(&buf);
+		wt_status_add_cut_line(s->fp);
 	}
 	run_diff_index(&rev, 1);
 }
diff --git a/wt-status.h b/wt-status.h
index 30a4812..b56ce3f 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -92,6 +92,7 @@ struct wt_status_state {
 };
 
 void wt_status_truncate_message_at_cut_line(struct strbuf *);
+void wt_status_add_cut_line(FILE *fp);
 void wt_status_prepare(struct wt_status *s);
 void wt_status_print(struct wt_status *s);
 void wt_status_collect(struct wt_status *s);
-- 
1.8.5.2.240.g8478abd
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 9 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.