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

Re: [PATCHv2 3/4] git-am foreign patch support: StGIT support

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
May 27, 2009, 08:29 UTC
Message-ID
<cb7bb73a0905270129j375ac104yb9ca8601312ddbde@mail.gmail.com>
In-Reply-To
<7v7i03j9mb.fsf@alter.siamese.dyndns.org>
On Wed, May 27, 2009 at 9:19 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>
>> +             # set the patch format appropriately
>> +             patch_format=stgit
>> +             # now handle the actual StGIT patches
>> +             split_patches "$@"
>
> Can an stgit patch file (or the leading pathname for that matter) have IFS
> character in its name?
StGIT sanitizes filenames in a way similar to what format-patch does.
Show 30 quoted lines
>> +             ;;
>> +     stgit)
>> +             this=0
>> +             for stgit in "$@"
>> +             do
>> +                     this=`expr "$this" + 1`
>> +                     msgnum=`printf "%0${prec}d" $this`
>> +                     touch "$dotest/$msgnum"
>
> Portability tip from an old timer: do not create a new empty file with
> "touch" (only use that command to update the timestamp of an existing
> file).
>
> Instead say
>
>        >"$dotest/$msgnum"
>
>> +                     # Awk version of StGIT parse_patch. The first nonemptyline
>> +                     # not starting with Author, From or Date is the
>> +                     # subject, and the body starts with the next nonempty
>> +                     # line not starting with Author, From or Date
>> +                     awk 'BEGIN { subject=0 }
>> +                     {
>> +                             if (subject > 1)
>> +                                     print ;
>> +                             else if (/^$/) next ;
>> +                             else if (/^Author:/) print sub("Author", "From"), $ORS ;
>
> Can any token that match Author other than the initial "Author: " appear
> on this line?
Irrelevant, sub only substitutes the first hit so only the initial
Author: is replaced.
> Since we rely on Perl but not awk in core-ish part of the scripted
> Porcelains, it might be a good idea to write this in Perl as well.

By 'as well' you mean in case awk is missing, and have both, or by only keeping a perl version?

-- 
Giuseppe "Oblomov" Bilotta
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 11 in “[PATCHv2 0/4] git-am support for foreign patches”
  1. Giuseppe BilottaMay 26, 2009
  2. 1/4 git-am foreign patch support: introduce patch_formatGiuseppe Bilotta, May 26, 2009
  3. 2/4 git-am foreign patch support: autodetect some patch formatsGiuseppe Bilotta, May 26, 2009
  4. 3/4 git-am foreign patch support: StGIT supportGiuseppe Bilotta, May 26, 2009
  5. 4/4 git-am: refactor 'cleaning up and aborting'Giuseppe Bilotta, May 26, 2009
  6. Junio C HamanoMay 27, 2009
  7. Junio C HamanoMay 27, 2009
  8. Giuseppe BilottaMay 27, 2009
  9. Junio C HamanoMay 27, 2009
  10. Junio C HamanoMay 27, 2009
  11. Giuseppe BilottaMay 27, 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.