Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: git commit -v does not removes the patch

From: Jeff King <hidden>
Date: 2016-06-15 22:45:38
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

On Tue, Nov 11, 2008 at 08:56:34AM +0100, Santi Béjar wrote:
Almost! I have diff.mnemonicprefix=true, if I unset it everything works.
Ah, indeed. The obvious fix is just loosening our match a little bit:
diff --git a/builtin-commit.c b/builtin-commit.c
index 93ca496..a721990 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -1015,7 +1015,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	}
 
 	/* Truncate the message just before the diff, if any. */
-	p = strstr(sb.buf, "\ndiff --git a/");
+	p = strstr(sb.buf, "\ndiff --git ");
 	if (p != NULL)
 		strbuf_setlen(&sb, p - sb.buf + 1);
 
But I have to wonder if there is some more robust solution. It seems
like this can have false positives if you include diff output in your
commit message, and a potential false negative if you delete the newline
(e.g., delete everything up to "diff --git", making it the first line).

But I guess we haven't seen a lot of complaints, so maybe those
conditions aren't worth worrying about.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help