wt-status.c: move cut-line print code out to wt_status_add_cut_line
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Feb 17, 2014 at 19:15 UTC
fcef9312a4ad3d94bfa2d02c41e46eb6adcde9b1
2 files changed
+13
-7
wt-status.c
+12
-7
@@ -808,6 +808,17 @@ void wt_status_truncate_message_at_cut_line(struct strbuf *buf)
808
strbuf_release(&pattern);
809
}
810
811
+void wt_status_add_cut_line(FILE *fp)
812
+{
813
+ const char *explanation = _("Do not touch the line above.\nEverything below will be removed.");
814
+ struct strbuf buf = STRBUF_INIT;
815
+
816
+ fprintf(fp, "%c %s", comment_line_char, cut_line);
817
+ strbuf_add_commented_lines(&buf, explanation, strlen(explanation));
818
+ fputs(buf.buf, fp);
819
+ strbuf_release(&buf);
820
+}
821
+
822
static void wt_status_print_verbose(struct wt_status *s)
823
{
824
struct rev_info rev;
@@ -833,14 +844,8 @@ static void wt_status_print_verbose(struct wt_status *s)
844
* diff before committing.
845
*/
846
if (s->fp != stdout) {
836
- const char *explanation = _("Do not touch the line above.\nEverything below will be removed.");
837
- struct strbuf buf = STRBUF_INIT;
838
-
847
rev.diffopt.use_color = 0;
840
- fprintf(s->fp, "%c %s", comment_line_char, cut_line);
841
- strbuf_add_commented_lines(&buf, explanation, strlen(explanation));
842
- fputs(buf.buf, s->fp);
843
- strbuf_release(&buf);
848
+ wt_status_add_cut_line(s->fp);
849
}
850
run_diff_index(&rev, 1);
851
}
wt-status.h
+1
@@ -92,6 +92,7 @@ struct wt_status_state {
92
};
93
94
void wt_status_truncate_message_at_cut_line(struct strbuf *);
95
+void wt_status_add_cut_line(FILE *fp);
96
void wt_status_prepare(struct wt_status *s);
97
void wt_status_print(struct wt_status *s);
98
void wt_status_collect(struct wt_status *s);