diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-03-25 11:07:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-25 11:07:48 -0700 |
commit | 46c0f913a49218a8a94d30c5a2df792a16aab827 (patch) | |
tree | efc504f849bced5dd3c5b155ab5c4fce4fcbcf14 /wt-status.c | |
parent | d4c6e9fb6f0db328a40905a3555f8f41d37aaec5 (diff) | |
parent | 75df1f434f8cfdac1c8eeacae259ab375c01385b (diff) | |
download | git-46c0f913a49218a8a94d30c5a2df792a16aab827.tar.gz |
Merge branch 'nd/commit-editor-cleanup'
"git commit --cleanup=<mode>" learned a new mode, scissors.
* nd/commit-editor-cleanup:
commit: add --cleanup=scissors
wt-status.c: move cut-line print code out to wt_status_add_cut_line
wt-status.c: make cut_line[] const to shrink .data section a bit
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/wt-status.c b/wt-status.c index c89c3bb537..e1827faf07 100644 --- a/wt-status.c +++ b/wt-status.c @@ -17,7 +17,7 @@ #include "strbuf.h" #include "utf8.h" -static char cut_line[] = +static const char cut_line[] = "------------------------ >8 ------------------------\n"; static char default_wt_status_colors[][COLOR_MAXLEN] = { @@ -841,6 +841,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; @@ -866,14 +877,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); } |