Re: [PATCH] git mailinfo strips important context from patch subjects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paolo Bonzini wrote:
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 <bonzini@xxxxxxx>
---
 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;
 				}


Pardon my ignorance, but wouldn't this still remove not only
"[PATCH 4/5]", but all of [PATCH 4/5] [sbuild]" anyway? The
parameters to strbuf_remove() seem unchanged.

--
Andreas Ericsson                   andreas.ericsson@xxxxxx
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]