{"thread":{"id":"19464","subject":"[PATCH 2/2] git-am: support StGit patch series","startedAt":"2009-05-24T07:19:18Z","lastAt":"2009-05-24T07:19:18Z","messageCount":1,"participants":["Giuseppe Bilotta"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"114549","messageId":"1243149558-17160-3-git-send-email-giuseppe.bilotta@gmail.com","threadId":"19464","inReplyTo":null,"subject":"[PATCH 2/2] git-am: support StGit patch series","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-05-24T07:19:18Z","receivedAt":"2009-05-24T07:19:18Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Stacked Git exports patch series with an 'index', a file containing\nthe list of the exported patches by filename. The file can be detected\nby the '# This series applies on GIT commit somehash' header, and in\nsuch a case git-am can replace its argument list with the list of files\ntaken from the index, proceeding then to import the whole series.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n git-am.sh |   22 ++++++++++++++++++++++\n 1 files changed, 22 insertions(+), 0 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 578780b..d65e3c1 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -274,6 +274,28 @@ else\n \t\tdone\n \t\tshift\n \tfi\n+\t# if a single argument was passed, check if it's a StGit patch series\n+\t# index by checking if the first line begins with '# This series'\n+\tif test $# = 1\n+\tthen\n+\t\tread is_sharp is_this is_series is_therest < \"$1\"\n+\t\tif test x\"$is_sharp $is_this $is_series\" = 'x# This series'\n+\t\tthen\n+\t\t\t# replace the argument list with the files listed\n+\t\t\t# in the series index, prefixing them with the\n+\t\t\t# series index dirname\n+\t\t\tseries_dir=`dirname \"$1\"`\n+\t\t\twhile read filename\n+\t\t\tdo\n+\t\t\t\tset \"$@\" \"$series_dir/$filename\"\n+\t\t\tdone < \"$1\"\n+\t\t\t# remove the series index name\n+\t\t\tshift\n+\t\t\t# and skip the first line of the series\n+\t\t\t# index, which was the comment\n+\t\t\tshift\n+\t\tfi\n+\tfi\n \tgit mailsplit -d\"$prec\" -o\"$dotest\" -b -- \"$@\" > \"$dotest/last\" ||  {\n \t\trm -fr \"$dotest\"\n \t\texit 1\n-- \n1.6.3.1.212.g6c0d3.dirty\n"}]}