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

Re: [PATCH v5] git-am: allow e-mail file(s) as input

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2009, 07:24 UTC
Message-ID
<7v8wip9jjw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4A5ED22B.6050101@gmail.com>
Stephen Boyd <bebarino@gmail.com> writes:
Show 27 quoted lines
> Nicolas Sebrecht wrote:
>> diff --git a/git-am.sh b/git-am.sh
>> index d64d997..2b55ddc 100755
>> --- a/git-am.sh
>> +++ b/git-am.sh
>> @@ -162,6 +162,17 @@ check_patch_format () {
>>  		return 0
>>  	fi
>>  
>> +	# Then, accept what really looks like (series of) email(s).
>> +	# the first sed select headers but the folded ones
>> +	sed -e '/^$/q' -e '/^[[:blank:]]/d' "$1" |
>> +	# this one is necessary for the next 'grep -v'
>> +	sed -e '/^$/d' |
>> +	grep -v -E -e '^[A-Za-z]+(-[A-Za-z]+)*:' ||
>> +	{
>> +		patch_format=mbox
>> +		return 0
>> +	}
>> +
>>  	# otherwise, check the first few lines of the first patch to try
>>  	# to detect its format
>>  	{
>
> This fails t4150-am.sh #10 (am -3 -q is quiet). You should redirect the
> output of the sed and grep to /dev/null like Junio did in his "how about
> this" patch.

Honestly speaking, I do not understand why Nicolas changed my patch at all.

This patch wastes an extra sed process, introduces [[:blank::]] where space and tab inside [] is perfectly adequate, and we know the latter is understood by everybody's sed.

The worst part is that this check was moved before the most common case of mbox file for which none of the overhead for this this extra processing is necessary.

Admittedly, it was a "something like this" patch and wasn't tested at all, and I would not be entirely surprised if he saw some breakages in it after testing with my patch, but if that was the case, some comment after --- would have been very helpful. Nicolas?

> Also, writing some tests would be helpful.

That is true. A test would illustrate why this more expensive test must come before the existing cheaper tests for common cases (if such a breakage was the reason his patch looks different from mine), for example.

Previous: Stephen BoydNext: Nicolas Sebrecht
Message 15 of 26 in “git-am: fix maildir support regression: accept email file as patch”
  1. git-am: fix maildir support regression: accept email file as patchNicolas Sebrecht, Jul 15, 2009
  2. Re: git-am: fix maildir support regression: accept email file as patchNicolas Sebrecht, Jul 15, 2009
  3. Junio C HamanoJul 15, 2009
  4. Junio C HamanoJul 15, 2009
  5. Re: git-am: fix maildir support regression: accept email file as patchNicolas Sebrecht, Jul 16, 2009
  6. Re: git-am: fix maildir support regression: accept email file as patchNicolas Sebrecht, Jul 16, 2009
  7. Junio C HamanoJul 16, 2009
  8. Re: git-am: fix maildir support regression: accept email file as patchNicolas Sebrecht, Jul 16, 2009
  9. Re: git-am: fix maildir support regression: accept email file as patchNicolas Sebrecht, Jul 16, 2009
  10. Junio C HamanoJul 16, 2009
  11. git-am: allow e-mail file(s) as inputNicolas Sebrecht, Jul 16, 2009
  12. Re: git-am: allow e-mail file(s) as inputNicolas Sebrecht, Jul 16, 2009
  13. git-am: allow e-mail file(s) as inputNicolas Sebrecht, Jul 16, 2009
  14. Stephen BoydJul 16, 2009
  15. Junio C HamanoJul 16, 2009
  16. Re: git-am: allow e-mail file(s) as inputNicolas Sebrecht, Jul 16, 2009
  17. Re: git-am: allow e-mail file(s) as inputNicolas Sebrecht, Jul 16, 2009
  18. Johannes SixtJul 16, 2009
  19. Johannes SixtJul 16, 2009
  20. mailinfo: allow e-mail files as inputNicolas Sebrecht, Jul 16, 2009
  21. Junio C HamanoJul 17, 2009
  22. Re: mailinfo: allow e-mail files as inputNicolas Sebrecht, Jul 17, 2009
  23. Nanako ShiraishiJul 17, 2009
  24. Junio C HamanoJul 17, 2009
  25. Re: mailinfo: allow e-mail files as inputNicolas Sebrecht, Jul 17, 2009
  26. mailinfo: allow e-mail files as inputNicolas Sebrecht, Aug 6, 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.