git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/3] wt-status.c: move cut-line print code out to wt_status_add_cut_line
Date: Sun, 16 Feb 2014 10:37:19 +0700	[thread overview]
Message-ID: <1392521840-21628-3-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1392521840-21628-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

  parent reply	other threads:[~2014-02-16  3:37 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 ` Nguyễn Thái Ngọc Duy [this message]
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
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=1392521840-21628-3-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /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).