Thread (6 messages) flat view 6 messages, 5 authors, 2016-06-15
DORMANTno replies

[PATCH] git mailinfo strips important context from patch subjects

From: Paolo Bonzini <hidden>
Date: 2016-06-15 22:47:00
Subsystem: the rest · Maintainer: Linus Torvalds

Would it be possible to change the git-mailinfo logic to use a less
greedy pattern match?
Like this?  (I also simplified the first part of the if condition since I
was at it).  Anyone, feel free to resubmit it as a proper patch.

Almost-Signed-off-by: Paolo Bonzini [off-list ref]
---
 builtin-mailinfo.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 92637ac..d340ae6 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -237,7 +237,8 @@ static void cleanup_subject(struct strbuf *subject)
 		case '[':
 			if ((pos = strchr(subject->buf, ']'))) {
 				remove = pos - subject->buf;
-				if (remove <= (subject->len - remove) * 2) {
+				if (remove <= subject->len * 2 / 3
+				    && memmem(subject->buf, remove, 'PATCH', 5)) {
 					strbuf_remove(subject, 0, remove + 1);
 					continue;
 				}
-- 
1.6.0.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help