summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87ab799)
raw | patch | inline | side by side (parent: 87ab799)
author | Don Zickus <dzickus@redhat.com> | |
Mon, 12 Mar 2007 19:52:06 +0000 (15:52 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 13 Mar 2007 06:33:41 +0000 (23:33 -0700) |
I have come across many emails that use long strings of '-'s as separators
for ideas. This patch below limits the separator to only 3 '-', with the
intent that long string of '-'s will stay in the commit msg and not in the
patch file.
Signed-off-by: Don Zickus <dzickus@redhat.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
for ideas. This patch below limits the separator to only 3 '-', with the
intent that long string of '-'s will stay in the commit msg and not in the
patch file.
Signed-off-by: Don Zickus <dzickus@redhat.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-mailinfo.c | patch | blob | history |
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 3f5cb8719b4f659fa1f5de422bd890304f223768..d94578cb4ac0649913db1542f876d5010ece7f0f 100644 (file)
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
return (fgets(line, sizeof(line), fin) != NULL);
}
+static inline int patchbreak(const char *line)
+{
+ /* Beginning of a "diff -" header? */
+ if (!memcmp("diff -", line, 6))
+ return 1;
+
+ /* CVS "Index: " line? */
+ if (!memcmp("Index: ", line, 7))
+ return 1;
+
+ /*
+ * "--- <filename>" starts patches without headers
+ * "---<sp>*" is a manual separator
+ */
+ if (!memcmp("---", line, 3)) {
+ line += 3;
+ /* space followed by a filename? */
+ if (line[0] == ' ' && !isspace(line[1]))
+ return 1;
+ /* Just whitespace? */
+ for (;;) {
+ unsigned char c = *line++;
+ if (c == '\n')
+ return 1;
+ if (!isspace(c))
+ break;
+ }
+ return 0;
+ }
+ return 0;
+}
+
+
static int handle_commit_msg(char *line)
{
static int still_looking = 1;
return 0;
}
- if (!memcmp("diff -", line, 6) ||
- !memcmp("---", line, 3) ||
- !memcmp("Index: ", line, 7)) {
+ if (patchbreak(line)) {
fclose(cmitmsg);
cmitmsg = NULL;
return 1;