diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-03-07 15:59:41 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-07 15:59:41 -0800 |
commit | 798ddfc17fbbe58494f2af0f71e0b53264ee82b5 (patch) | |
tree | 24daff91349aa29c3a7f08881c7c39adc25a2e29 /wt-status.c | |
parent | ae46d5fb98b316767f51a82fc0c1441174995a34 (diff) | |
parent | e90cc075cc43f2bf08a8963ae84d3e4da50ebfc3 (diff) | |
download | git-798ddfc17fbbe58494f2af0f71e0b53264ee82b5.tar.gz |
Merge branch 'jt/commit-redundant-scissors-fix'
"git commit -v --cleanup=scissors" used to add the scissors line
twice in the log message buffer, which has been corrected.
* jt/commit-redundant-scissors-fix:
commit: unify logic to avoid multiple scissors lines when merging
commit: avoid redundant scissor line with --cleanup=scissors -v
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c index b5a29083df..7108a92b52 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1107,12 +1107,15 @@ void wt_status_append_cut_line(struct strbuf *buf) strbuf_add_commented_lines(buf, explanation, strlen(explanation), comment_line_char); } -void wt_status_add_cut_line(FILE *fp) +void wt_status_add_cut_line(struct wt_status *s) { struct strbuf buf = STRBUF_INIT; + if (s->added_cut_line) + return; + s->added_cut_line = 1; wt_status_append_cut_line(&buf); - fputs(buf.buf, fp); + fputs(buf.buf, s->fp); strbuf_release(&buf); } @@ -1143,11 +1146,12 @@ static void wt_longstatus_print_verbose(struct wt_status *s) * file (and even the "auto" setting won't work, since it * will have checked isatty on stdout). But we then do want * to insert the scissor line here to reliably remove the - * diff before committing. + * diff before committing, if we didn't already include one + * before. */ if (s->fp != stdout) { rev.diffopt.use_color = 0; - wt_status_add_cut_line(s->fp); + wt_status_add_cut_line(s); } if (s->verbose > 1 && s->committable) { /* print_updated() printed a header, so do we */ |