git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: support StGit patch series
Date: Sun, 24 May 2009 09:19:18 +0200	[thread overview]
Message-ID: <1243149558-17160-3-git-send-email-giuseppe.bilotta@gmail.com> (raw)

Stacked Git exports patch series with an 'index', a file containing
the list of the exported patches by filename. The file can be detected
by the '# This series applies on GIT commit somehash' header, and in
such a case git-am can replace its argument list with the list of files
taken from the index, proceeding then to import the whole series.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 git-am.sh |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index 578780b..d65e3c1 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -274,6 +274,28 @@ else
 		done
 		shift
 	fi
+	# if a single argument was passed, check if it's a StGit patch series
+	# index by checking if the first line begins with '# This series'
+	if test $# = 1
+	then
+		read is_sharp is_this is_series is_therest < "$1"
+		if test x"$is_sharp $is_this $is_series" = 'x# This series'
+		then
+			# replace the argument list with the files listed
+			# in the series index, prefixing them with the
+			# series index dirname
+			series_dir=`dirname "$1"`
+			while read filename
+			do
+				set "$@" "$series_dir/$filename"
+			done < "$1"
+			# remove the series index name
+			shift
+			# and skip the first line of the series
+			# index, which was the comment
+			shift
+		fi
+	fi
 	git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" ||  {
 		rm -fr "$dotest"
 		exit 1
-- 
1.6.3.1.212.g6c0d3.dirty

                 reply	other threads:[~2009-05-24  7:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1243149558-17160-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).