git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] commit: Avoid redundant scissor line with --cleanup=scissors -v
@ 2024-02-26  4:23 Josh Triplett
  2024-02-26 18:03 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Josh Triplett @ 2024-02-26  4:23 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

`git commit --cleanup=scissors -v` currently 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.

Pass the cleanup mode into wt_status, so that wt_status_print can avoid
printing the extra scissors if already printed.

This moves the enum commit_msg_cleanup_mode from sequencer.h to
wt-status.h to allow wt_status to use the type. sequencer.h already
includes wt-status.h, so this doesn't affect anything else.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
 builtin/commit.c | 2 ++
 sequencer.h      | 7 -------
 wt-status.c      | 6 ++++--
 wt-status.h      | 8 ++++++++
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 6d1fa71676..6b2b412932 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -888,6 +888,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 	 */
 	s->hints = 0;
 
+	s->cleanup_mode = cleanup_mode;
+
 	if (clean_message_contents)
 		strbuf_stripspace(&sb, '\0');
 
diff --git a/sequencer.h b/sequencer.h
index dcef7bb99c..9f818e96f0 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -22,13 +22,6 @@ enum replay_action {
 	REPLAY_INTERACTIVE_REBASE
 };
 
-enum commit_msg_cleanup_mode {
-	COMMIT_MSG_CLEANUP_SPACE,
-	COMMIT_MSG_CLEANUP_NONE,
-	COMMIT_MSG_CLEANUP_SCISSORS,
-	COMMIT_MSG_CLEANUP_ALL
-};
-
 struct replay_opts {
 	enum replay_action action;
 
diff --git a/wt-status.c b/wt-status.c
index b5a29083df..459d399baa 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1143,11 +1143,13 @@ 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);
+		if (s->cleanup_mode != COMMIT_MSG_CLEANUP_SCISSORS)
+			wt_status_add_cut_line(s->fp);
 	}
 	if (s->verbose > 1 && s->committable) {
 		/* print_updated() printed a header, so do we */
diff --git a/wt-status.h b/wt-status.h
index 819dcad723..5ede705e93 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -22,6 +22,13 @@ enum color_wt_status {
 	WT_STATUS_MAXSLOT
 };
 
+enum commit_msg_cleanup_mode {
+	COMMIT_MSG_CLEANUP_SPACE,
+	COMMIT_MSG_CLEANUP_NONE,
+	COMMIT_MSG_CLEANUP_SCISSORS,
+	COMMIT_MSG_CLEANUP_ALL
+};
+
 enum untracked_status_type {
 	SHOW_NO_UNTRACKED_FILES,
 	SHOW_NORMAL_UNTRACKED_FILES,
@@ -130,6 +137,7 @@ struct wt_status {
 	int rename_score;
 	int rename_limit;
 	enum wt_status_format status_format;
+	enum commit_msg_cleanup_mode cleanup_mode;
 	struct wt_status_state state;
 	struct object_id oid_commit; /* when not Initial */
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-26  4:23 [PATCH] commit: Avoid redundant scissor line with --cleanup=scissors -v Josh Triplett
@ 2024-02-26 18:03 ` Junio C Hamano
  2024-02-27  8:32   ` Josh Triplett
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2024-02-26 18:03 UTC (permalink / raw)
  To: Josh Triplett; +Cc: git

Josh Triplett <josh@joshtriplett.org> writes:

> `git commit --cleanup=scissors -v` currently 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.

Interesting discovery.

> diff --git a/wt-status.c b/wt-status.c
> index b5a29083df..459d399baa 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -1143,11 +1143,13 @@ 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);
> +		if (s->cleanup_mode != COMMIT_MSG_CLEANUP_SCISSORS)
> +			wt_status_add_cut_line(s->fp);
>  	}

The machinery to populate the log message buffer should ideally be
taught to remember if it already has added a scissors-line and to
refrain from adding redundant ones.  That way, we do not have to
rely on the order of places that make wt_status_add_cut_line() calls
or what condition they use to decide to make these calls.

This hunk for example knows not just this one produces cut-line
after the other one potentially added one, but also the logic used
by the other one to decide to add one, which is even worse.  I find
the solution presented here a bit unsatisfactory, for this reason,
but for now it may be OK, as we probably are not adding any more
places and conditions to emit a scissors line.

>  builtin/commit.c | 2 ++
>  sequencer.h      | 7 -------
>  wt-status.c      | 6 ++++--
>  wt-status.h      | 8 ++++++++
>  4 files changed, 14 insertions(+), 9 deletions(-)

If this change did not break any existing tests that checked the
combination of options and output when they are used together, it
means we have a gap in the test coverage.  We needs a test or two
to protect this fix from future breakages.

Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-26 18:03 ` Junio C Hamano
@ 2024-02-27  8:32   ` Josh Triplett
  2024-02-27  9:16     ` [PATCH v2 1/2] " Josh Triplett
  2024-02-27 17:10     ` [PATCH] " Junio C Hamano
  0 siblings, 2 replies; 11+ messages in thread
From: Josh Triplett @ 2024-02-27  8:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Mon, Feb 26, 2024 at 10:03:22AM -0800, Junio C Hamano wrote:
> Josh Triplett <josh@joshtriplett.org> writes:
> 
> > `git commit --cleanup=scissors -v` currently 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.
> 
> Interesting discovery.
> 
> > diff --git a/wt-status.c b/wt-status.c
> > index b5a29083df..459d399baa 100644
> > --- a/wt-status.c
> > +++ b/wt-status.c
> > @@ -1143,11 +1143,13 @@ 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);
> > +		if (s->cleanup_mode != COMMIT_MSG_CLEANUP_SCISSORS)
> > +			wt_status_add_cut_line(s->fp);
> >  	}
> 
> The machinery to populate the log message buffer should ideally be
> taught to remember if it already has added a scissors-line and to
> refrain from adding redundant ones.  That way, we do not have to
> rely on the order of places that make wt_status_add_cut_line() calls
> or what condition they use to decide to make these calls.
> 
> This hunk for example knows not just this one produces cut-line
> after the other one potentially added one, but also the logic used
> by the other one to decide to add one, which is even worse.  I find
> the solution presented here a bit unsatisfactory, for this reason,
> but for now it may be OK, as we probably are not adding any more
> places and conditions to emit a scissors line.

I could add statefulness to wt_status_add_cut_line instead, on the
assumption that it's the only thing that should be adding a cut line,
and having it not add the line if previously added. For instance, it
could accept a pointer to the full wt_status rather than just the fp,
and keep a boolean state there.

> >  builtin/commit.c | 2 ++
> >  sequencer.h      | 7 -------
> >  wt-status.c      | 6 ++++--
> >  wt-status.h      | 8 ++++++++
> >  4 files changed, 14 insertions(+), 9 deletions(-)
> 
> If this change did not break any existing tests that checked the
> combination of options and output when they are used together, it
> means we have a gap in the test coverage.  We needs a test or two
> to protect this fix from future breakages.

I did run the testsuite, and it passed. I can add a simple test easily
enough.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-27  8:32   ` Josh Triplett
@ 2024-02-27  9:16     ` Josh Triplett
  2024-02-27  9:17       ` [PATCH v2 2/2] commit: Unify logic to avoid multiple scissors lines when merging Josh Triplett
  2024-02-27 17:43       ` [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v Junio C Hamano
  2024-02-27 17:10     ` [PATCH] " Junio C Hamano
  1 sibling, 2 replies; 11+ messages in thread
From: Josh Triplett @ 2024-02-27  9:16 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

`git commit --cleanup=scissors -v` currently 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 <josh@joshtriplett.org>
---
v2: Make wt_status_add_cut_line remember if it has added a cut line,
rather than making later callers try to figure out if it has been called
before. Add a test.

Note that other parts of the code do already try to figure out if the
*merge* logic has added scissors already, which is where
merge_contains_scissors comes from. Patch 2/2 unifies that machinery.

 builtin/commit.c            |  4 ++--
 t/t7502-commit-porcelain.sh |  5 +++++
 wt-status.c                 | 12 ++++++++----
 wt-status.h                 |  3 ++-
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 6d1fa71676..e0a6d43179 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -926,7 +926,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		if (whence != FROM_COMMIT) {
 			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
 				!merge_contains_scissors)
-				wt_status_add_cut_line(s->fp);
+				wt_status_add_cut_line(s);
 			status_printf_ln(
 				s, GIT_COLOR_NORMAL,
 				whence == FROM_MERGE ?
@@ -947,7 +947,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 			status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_all, comment_line_char);
 		else if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) {
 			if (whence == FROM_COMMIT && !merge_contains_scissors)
-				wt_status_add_cut_line(s->fp);
+				wt_status_add_cut_line(s);
 		} else /* COMMIT_MSG_CLEANUP_SPACE, that is. */
 			status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_space, comment_line_char);
 
diff --git a/t/t7502-commit-porcelain.sh b/t/t7502-commit-porcelain.sh
index a87c211d0b..b37e2018a7 100755
--- a/t/t7502-commit-porcelain.sh
+++ b/t/t7502-commit-porcelain.sh
@@ -736,6 +736,11 @@ test_expect_success 'message shows date when it is explicitly set' '
 	  .git/COMMIT_EDITMSG
 '
 
+test_expect_success 'message does not have multiple scissors lines' '
+	git commit --cleanup=scissors -v --allow-empty -e -m foo &&
+	test $(grep -c -e "--- >8 ---" .git/COMMIT_EDITMSG) -eq 1
+'
+
 test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
 
 	echo >>negative &&
diff --git a/wt-status.c b/wt-status.c
index ea13f5d8db..2d576f7a44 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1108,12 +1108,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);
 }
 
@@ -1144,11 +1147,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 */
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);
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/2] commit: Unify logic to avoid multiple scissors lines when merging
  2024-02-27  9:16     ` [PATCH v2 1/2] " Josh Triplett
@ 2024-02-27  9:17       ` Josh Triplett
  2024-02-27 17:43       ` [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v Junio C Hamano
  1 sibling, 0 replies; 11+ messages in thread
From: Josh Triplett @ 2024-02-27  9:17 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

prepare_to_commit has some logic to figure out whether merge already
added a scissors line, and therefore it shouldn't add another. Now that
wt_status_add_cut_line has built-in state for whether it has
already added a previous line, just set that state instead, and then
remove that condition from subsequent calls to wt_status_add_cut_line.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
v2: New patch.

 builtin/commit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index e0a6d43179..142f54ea7c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -737,7 +737,6 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 	const char *hook_arg2 = NULL;
 	int clean_message_contents = (cleanup_mode != COMMIT_MSG_CLEANUP_NONE);
 	int old_display_comment_prefix;
-	int merge_contains_scissors = 0;
 	int invoked_hook;
 
 	/* This checks and barfs if author is badly specified */
@@ -841,7 +840,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		    wt_status_locate_end(sb.buf + merge_msg_start,
 					 sb.len - merge_msg_start) <
 				sb.len - merge_msg_start)
-			merge_contains_scissors = 1;
+			s->added_cut_line = 1;
 	} else if (!stat(git_path_squash_msg(the_repository), &statbuf)) {
 		if (strbuf_read_file(&sb, git_path_squash_msg(the_repository), 0) < 0)
 			die_errno(_("could not read SQUASH_MSG"));
@@ -924,8 +923,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 			  " yourself if you want to.\n"
 			  "An empty message aborts the commit.\n");
 		if (whence != FROM_COMMIT) {
-			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
-				!merge_contains_scissors)
+			if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS)
 				wt_status_add_cut_line(s);
 			status_printf_ln(
 				s, GIT_COLOR_NORMAL,
@@ -946,7 +944,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		if (cleanup_mode == COMMIT_MSG_CLEANUP_ALL)
 			status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_all, comment_line_char);
 		else if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) {
-			if (whence == FROM_COMMIT && !merge_contains_scissors)
+			if (whence == FROM_COMMIT)
 				wt_status_add_cut_line(s);
 		} else /* COMMIT_MSG_CLEANUP_SPACE, that is. */
 			status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_space, comment_line_char);
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-27  8:32   ` Josh Triplett
  2024-02-27  9:16     ` [PATCH v2 1/2] " Josh Triplett
@ 2024-02-27 17:10     ` Junio C Hamano
  1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2024-02-27 17:10 UTC (permalink / raw)
  To: Josh Triplett; +Cc: git

Josh Triplett <josh@joshtriplett.org> writes:

> I could add statefulness to wt_status_add_cut_line instead, on the
> assumption that it's the only thing that should be adding a cut line,
> and having it not add the line if previously added. For instance, it
> could accept a pointer to the full wt_status rather than just the fp,
> and keep a boolean state there.

Yeah, that approach also has to assume that wt_status structure is
used only once to create a single message buffer without being
reused, but I think that is a safe assumption, too.  The function
being the only thing that adds the scissors line should also be a
safe assumption in code hygiene standpoint---if somebody else tries
to manually write such a line, we'll shoot such a patch down and
tell them to call this function anyway ;-).

> I did run the testsuite, and it passed. I can add a simple test easily
> enough.

It would be prudent to do so.

Thanks.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-27  9:16     ` [PATCH v2 1/2] " Josh Triplett
  2024-02-27  9:17       ` [PATCH v2 2/2] commit: Unify logic to avoid multiple scissors lines when merging Josh Triplett
@ 2024-02-27 17:43       ` Junio C Hamano
  2024-02-29  4:19         ` Josh Triplett
  1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2024-02-27 17:43 UTC (permalink / raw)
  To: Josh Triplett; +Cc: git

Josh Triplett <josh@joshtriplett.org> writes:

> diff --git a/wt-status.c b/wt-status.c
> index ea13f5d8db..2d576f7a44 100644

I do not seem to have the preimage ea13f5d8db; as a bugfix patch, it
would be preferrable to make the patches not to depend on anything
in flight.  If feasible, it may even be nicer to base them on one of
the maintenance tracks.

I managed to wiggle the patch in (somehow a context line was
misindented), so there hopefully is no need to resend.

Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-27 17:43       ` [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v Junio C Hamano
@ 2024-02-29  4:19         ` Josh Triplett
  2024-02-29  5:41           ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Josh Triplett @ 2024-02-29  4:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Tue, Feb 27, 2024 at 09:43:21AM -0800, Junio C Hamano wrote:
> Josh Triplett <josh@joshtriplett.org> writes:
> 
> > diff --git a/wt-status.c b/wt-status.c
> > index ea13f5d8db..2d576f7a44 100644
> 
> I do not seem to have the preimage ea13f5d8db; as a bugfix patch, it
> would be preferrable to make the patches not to depend on anything
> in flight.  If feasible, it may even be nicer to base them on one of
> the maintenance tracks.
> 
> I managed to wiggle the patch in (somehow a context line was
> misindented), so there hopefully is no need to resend.

Sorry about that. I had these two patches in the same branch as my other recent patch
`advice: Add advice.scissors to suppress "do not modify or remove this line"`
but the two ended up independent so I didn't send them as a series. That
patch and this two-patch series should be applicable independently.

If you do end up needing a resend of any of them, I'm happy to do so.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-29  4:19         ` Josh Triplett
@ 2024-02-29  5:41           ` Junio C Hamano
  2024-02-29  6:09             ` Josh Triplett
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2024-02-29  5:41 UTC (permalink / raw)
  To: Josh Triplett; +Cc: git

Josh Triplett <josh@joshtriplett.org> writes:

> If you do end up needing a resend of any of them, I'm happy to do so.

I do not think there is need for resending, but I think you promised
to add some tests earlier, so an updated patch may be in order ;-)

Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-29  5:41           ` Junio C Hamano
@ 2024-02-29  6:09             ` Josh Triplett
  2024-02-29 16:38               ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Josh Triplett @ 2024-02-29  6:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Wed, Feb 28, 2024 at 09:41:22PM -0800, Junio C Hamano wrote:
> Josh Triplett <josh@joshtriplett.org> writes:
> > If you do end up needing a resend of any of them, I'm happy to do so.
>
> I do not think there is need for resending, but I think you promised
> to add some tests earlier, so an updated patch may be in order ;-)

I did add a test; v2 that you replied to has this:
> Add a test for this.
[...]
>  t/t7502-commit-porcelain.sh |  5 +++++
[...]
> diff --git a/t/t7502-commit-porcelain.sh b/t/t7502-commit-porcelain.sh
> index a87c211d0b..b37e2018a7 100755
> --- a/t/t7502-commit-porcelain.sh
> +++ b/t/t7502-commit-porcelain.sh
> @@ -736,6 +736,11 @@ test_expect_success 'message shows date when it is explicitly set' '
>         .git/COMMIT_EDITMSG
>  '
>  
> +test_expect_success 'message does not have multiple scissors lines' '
> +     git commit --cleanup=scissors -v --allow-empty -e -m foo &&
> +     test $(grep -c -e "--- >8 ---" .git/COMMIT_EDITMSG) -eq 1
> +'
> +
>  test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
>  
>       echo >>negative &&

https://lore.kernel.org/git/xmqqedcxvnn8.fsf@gitster.g/T/#Z2e.:..:4f97933f173220544a5be2bf05c2bee2b044d2b1.1709024540.git.josh::40joshtriplett.org:1t:t7502-commit-porcelain.sh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v
  2024-02-29  6:09             ` Josh Triplett
@ 2024-02-29 16:38               ` Junio C Hamano
  0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2024-02-29 16:38 UTC (permalink / raw)
  To: Josh Triplett; +Cc: git

Josh Triplett <josh@joshtriplett.org> writes:

> I did add a test; v2 that you replied to has this:
>> Add a test for this.

Thanks.  Let's mark it for 'next' then.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-29 16:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26  4:23 [PATCH] commit: Avoid redundant scissor line with --cleanup=scissors -v Josh Triplett
2024-02-26 18:03 ` Junio C Hamano
2024-02-27  8:32   ` Josh Triplett
2024-02-27  9:16     ` [PATCH v2 1/2] " Josh Triplett
2024-02-27  9:17       ` [PATCH v2 2/2] commit: Unify logic to avoid multiple scissors lines when merging Josh Triplett
2024-02-27 17:43       ` [PATCH v2 1/2] commit: Avoid redundant scissor line with --cleanup=scissors -v Junio C Hamano
2024-02-29  4:19         ` Josh Triplett
2024-02-29  5:41           ` Junio C Hamano
2024-02-29  6:09             ` Josh Triplett
2024-02-29 16:38               ` Junio C Hamano
2024-02-27 17:10     ` [PATCH] " Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).