From 688a0a751e9ee032be9fb70d7d63220bc85acae1 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Tue, 27 Feb 2024 01:16:09 -0800 Subject: commit: avoid redundant scissor line with --cleanup=scissors -v `git commit --cleanup=scissors -v` prints two scissors lines: one at the start of the comment lines, and the other right before the diff. This is redundant, and pushes the diff further down in the user's editor than it needs to be. Make wt_status_add_cut_line() remember if it has added a cut line before, and avoid adding a redundant one. Add a test for this. Signed-off-by: Josh Triplett Signed-off-by: Junio C Hamano --- wt-status.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wt-status.h') diff --git a/wt-status.h b/wt-status.h index 819dcad723..5e99ba4707 100644 --- a/wt-status.h +++ b/wt-status.h @@ -130,6 +130,7 @@ struct wt_status { int rename_score; int rename_limit; enum wt_status_format status_format; + unsigned char added_cut_line; /* boolean */ struct wt_status_state state; struct object_id oid_commit; /* when not Initial */ @@ -147,7 +148,7 @@ struct wt_status { size_t wt_status_locate_end(const char *s, size_t len); void wt_status_append_cut_line(struct strbuf *buf); -void wt_status_add_cut_line(FILE *fp); +void wt_status_add_cut_line(struct wt_status *s); void wt_status_prepare(struct repository *r, struct wt_status *s); void wt_status_print(struct wt_status *s); void wt_status_collect(struct wt_status *s); -- cgit v1.2.3