From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Subject: [PATCH 2/2] git-am foreign patch support: StGIT
Date: Mon, 25 May 2009 21:14:06 +0200 [thread overview]
Message-ID: <1243278846-14120-3-git-send-email-giuseppe.bilotta@gmail.com> (raw)
In-Reply-To: <1243278846-14120-2-git-send-email-giuseppe.bilotta@gmail.com>
Convert StGIT patches to mbox format so that they can be imported.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
git-am.sh | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 3508b7e..5199354 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -375,6 +375,38 @@ else
exit 1
}
;;
+ stgit)
+ this=0
+ for stgit in "$@"
+ do
+ this=`expr "$this" + 1`
+ msgnum=`printf "%0${prec}d" $this`
+ touch "$dotest/$msgnum"
+ # Awk version of StGIT parse_patch
+ awk 'BEGIN { subject=0 }
+ {
+ if (subject > 1)
+ print ;
+ else if (/^$/) next ;
+ else if (/^Author:/) print sub("Author", "From"), $ORS ;
+ else if (/^(From|Date)/) print ;
+ else if (subject) {
+ subject = 2 ;
+ print "" ;
+ print ;
+ } else {
+ print "Subject:", $0 ;
+ subject = 1;
+ }
+ }' "$stgit" > "$dotest/$msgnum" || {
+ echo "Failed to import $patch_format patch $stgit"
+ exit 1
+ }
+ done
+ echo "$this" > "$dotest/last"
+ this=
+ msgnum=
+ ;;
*)
echo "Patch format $patch_format is not currently handled, sorry"
exit 1
--
1.6.3.1.245.g4529.dirty
next prev parent reply other threads:[~2009-05-25 19:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-25 19:14 [PATCH 0/2] git-am foreign patch support Giuseppe Bilotta
2009-05-25 19:14 ` [PATCH 1/2] git-am foreign patch support: format autodetection Giuseppe Bilotta
2009-05-25 19:14 ` Giuseppe Bilotta [this message]
2009-05-25 22:23 ` Junio C Hamano
2009-05-25 22:49 ` Giuseppe Bilotta
2009-05-25 19:19 ` [PATCH 0/2] git-am foreign patch support Sverre Rabbelier
2009-05-25 19:24 ` 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=1243278846-14120-3-git-send-email-giuseppe.bilotta@gmail.com \
--to=giuseppe.bilotta@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).