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

Re: [RFC PATCHv3 1/4] am: avoid re-directing stdin twice

From
Stephen Boyd <bebarino@gmail.com>
Date
Sep 5, 2014, 23:18 UTC
Message-ID
<CALaEz9Xbk_sAAJ0wNCgC9Rzr=E9Ke0H3YEwGr1_4VNgv0AwYhw@mail.gmail.com>
In-Reply-To
<xmqqfvg5puws.fsf@gitster.dls.corp.google.com>
(replying from webmail interface)
On Fri, Sep 5, 2014 at 3:25 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Redoing what e3f67d30 (am: fix patch format detection for
>> Thunderbird "Save As" emails, 2010-01-25) tried to do without
>> wasting a fork and a pipe may be a workable improvement.
>>
>> I see Stephen who wrote the original "Thunderbird save-as" is
>> already on the Cc list.  How about doing it this way instead?
>

It was so long ago I can't even remember writing that patch. But I googled the thread from 4.5 years ago and I see that you suggested we use tr because \r is not portable[1].

Show 19 quoted lines
> Not that way, but more like this.
>
>  git-am.sh | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/git-am.sh b/git-am.sh
> index ee61a77..32e3039 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -250,8 +250,7 @@ check_patch_format () {
>                         # discarding the indented remainder of folded lines,
>                         # and see if it looks like that they all begin with the
>                         # header field names...
> -                       tr -d '\015' <"$1" |
> -                       sed -n -e '/^$/q' -e '/^[       ]/d' -e p |
> +                       sed -n -e 's/\r$//' -e '/^$/q' -e '/^[  ]/d' -e p |
>                         sane_egrep -v '^[!-9;-~]+:' >/dev/null ||
>                         patch_format=mbox
>                 fi
[1] http://git.661346.n2.nabble.com/PATCH-am-fix-patch-format-detection-for-Thunderbird-quot-Save-As-quot-emails-td4184273.html
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 13 in “[RFC PATCHv3 0/4] am: patch-format”
  1. Chris PackhamSep 5, 2014
  2. 1/4 am: avoid re-directing stdin twiceChris Packham, Sep 5, 2014
  3. Johannes SixtSep 5, 2014
  4. Chris PackhamSep 5, 2014
  5. Junio C HamanoSep 5, 2014
  6. Junio C HamanoSep 5, 2014
  7. Junio C HamanoSep 5, 2014
  8. Stephen BoydSep 5, 2014
  9. Junio C HamanoSep 6, 2014
  10. Torsten BögershausenSep 6, 2014
  11. 2/4 t/am: add test for stgit patch formatChris Packham, Sep 5, 2014
  12. 3/4 t/am: add tests for hg patch formatChris Packham, Sep 5, 2014
  13. 4/4 am: add gitk patch formatChris Packham, Sep 5, 2014

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.