git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Andreas Ericsson <ae@op5.se>
Date
Jun 29, 2009, 09:19 UTC
Message-ID
<4A48870B.5050802@op5.se>
In-Reply-To
<1246219664-11000-1-git-send-email-bonzini@gnu.org>
Paolo Bonzini wrote:
Show 25 quoted lines
>> 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@gnu.org>
> ---
>  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@op5.se
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.
Previous: Paolo BonziniNext: Paolo Bonzini
Message 19 of 21 in “git mailinfo strips important context from patch subjects”
  1. Roger LeighJun 28, 2009
  2. Jeff KingJun 28, 2009
  3. Junio C HamanoJun 28, 2009
  4. Andreas EricssonJun 29, 2009
  5. mailinfo: Remove only one set of square bracketsAndreas Ericsson, Jun 29, 2009
  6. Junio C HamanoJun 29, 2009
  7. Jeff KingJun 30, 2009
  8. builtin-mailinfo.c: Trim only first pair of square brackets in subjectRoger Leigh, Jun 29, 2009
  9. Jakub NarebskiJun 29, 2009
  10. Roger LeighJun 29, 2009
  11. Neil RobertsSep 22, 2009
  12. Neil RobertsSep 22, 2009
  13. Junio C HamanoSep 22, 2009
  14. Neil RobertsSep 22, 2009
  15. Jason HoldenSep 23, 2009
  16. 2/2 builtin-mailinfo.c: Free regular expression after useRoger Leigh, Jun 29, 2009
  17. Roger LeighJun 29, 2009
  18. git mailinfo strips important context from patch subjectsPaolo Bonzini, Jun 28, 2009
  19. Andreas EricssonJun 29, 2009
  20. Paolo BonziniJun 29, 2009
  21. Andreas EricssonJun 29, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.