]> git.ipfire.org Git - thirdparty/git.git/commitdiff
wt-status.c: move cut-line print code out to wt_status_add_cut_line
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 17 Feb 2014 12:15:31 +0000 (19:15 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2014 23:50:40 +0000 (15:50 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
wt-status.c
wt-status.h

index 65e35c30ac28c184a81364ddd448607892de69ad..ed31b6afbeadf93d23b5d9c4c3005074c7744fa3 100644 (file)
@@ -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);
 }
index 30a481258366733ad5d6a65e3a9c3ae1ee74e833..b56ce3f0355f3a1e188c7d9bd44ea90f0d06d76f 100644 (file)
@@ -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);