From: Junio C Hamano <gitster@pobox.com>
To: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCHv2 2/4] git-am foreign patch support: autodetect some patch formats
Date: Wed, 27 May 2009 00:19:40 -0700 [thread overview]
Message-ID: <7vd49vj9mb.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1243298290-5909-3-git-send-email-giuseppe.bilotta@gmail.com
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
> + # otherwise, check the first few lines of the first patch to try
> + # to detect its format
> + {
> + read l1
> + read l2
> + read l3
> + case "$l1" in
> + From\ *)
> + patch_format=mbox
> + ;;
> + From:\ *)
> + patch_format=mbox
> + ;;
> + '# This series applies on GIT commit'*)
> + patch_format=stgit-series
> + ;;
> + "# HG changeset patch")
> + patch_format=hg
> + ;;
> + *)
> + # if the second line is empty and the third is
> + # a From, Author or Date entry, this is very
> + # likely an StGIT patch
> + if test "x$l2" = x
> + then
> + case "$l3" in
> + From:\ *)
> + patch_format=stgit
> + ;;
> + Author:\ *)
> + patch_format=stgit
> + ;;
> + Date:\ *)
> + patch_format=stgit
> + ;;
> + *)
> + ;;
> + esac
> + fi
> + ;;
> + esac
Don't make the case unnecessary too deep nor redundant.
...
read l3
case "$l1" in
"From "* | "From: "* )
patch_format=mbox
;;
"# This ...")
...
;;
*)
case "$l2,$l3" in
,"From: "* | ,"Author: "* | ,"Date: "*)
patch_format=stgit
;;
esac
;;
esac
> + } < "$1"
> }
>
> split_patches () {
> --
> 1.6.3.1.248.gb44be
next prev parent reply other threads:[~2009-05-27 7:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 0:38 [PATCHv2 0/4] git-am support for foreign patches Giuseppe Bilotta
2009-05-26 0:38 ` [PATCHv2 1/4] git-am foreign patch support: introduce patch_format Giuseppe Bilotta
2009-05-26 0:38 ` [PATCHv2 2/4] git-am foreign patch support: autodetect some patch formats Giuseppe Bilotta
2009-05-26 0:38 ` [PATCHv2 3/4] git-am foreign patch support: StGIT support Giuseppe Bilotta
2009-05-26 0:38 ` [PATCHv2 4/4] git-am: refactor 'cleaning up and aborting' Giuseppe Bilotta
2009-05-27 7:19 ` Junio C Hamano
2009-05-27 7:19 ` [PATCHv2 3/4] git-am foreign patch support: StGIT support Junio C Hamano
2009-05-27 8:29 ` Giuseppe Bilotta
2009-05-27 20:50 ` Junio C Hamano
2009-05-27 7:19 ` Junio C Hamano [this message]
2009-05-27 8:19 ` [PATCHv2 2/4] git-am foreign patch support: autodetect some patch formats Giuseppe Bilotta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vd49vj9mb.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=giuseppe.bilotta@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).