summaryrefslogtreecommitdiff
path: root/git-am.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-03 11:01:12 -0700
committerJunio C Hamano <gitster@pobox.com>2015-08-03 11:01:12 -0700
commite7cf4b257179b4683fa32beb51f949666d36fe9c (patch)
tree39bc239b04ed0175dbf223bf295273cf5c59c615 /git-am.sh
parent7ebc8cbedd0e728d7ff00df63125de1a7adf5937 (diff)
parent9f0aa6e65447c719abe8fe739d9f1e40b7335af8 (diff)
downloadgit-e7cf4b257179b4683fa32beb51f949666d36fe9c.tar.gz
Merge branch 'pt/am-foreign'
Various enhancements around "git am" reading patches generated by foreign SCM. * pt/am-foreign: am: teach mercurial patch parser how to read from stdin am: use gmtime() to parse mercurial patch date t4150: test applying StGit series am: teach StGit patch parser how to read from stdin t4150: test applying StGit patch
Diffstat (limited to 'git-am.sh')
-rwxr-xr-xgit-am.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/git-am.sh b/git-am.sh
index 3af351ffaa..3b77028123 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -300,6 +300,7 @@ split_patches () {
;;
stgit)
this=0
+ test 0 -eq "$#" && set -- -
for stgit in "$@"
do
this=$(expr "$this" + 1)
@@ -321,7 +322,7 @@ split_patches () {
print "Subject: ", $_ ;
$subject = 1;
}
- ' < "$stgit" > "$dotest/$msgnum" || clean_abort
+ ' -- "$stgit" >"$dotest/$msgnum" || clean_abort
done
echo "$this" > "$dotest/last"
this=
@@ -329,6 +330,7 @@ split_patches () {
;;
hg)
this=0
+ test 0 -eq "$#" && set -- -
for hg in "$@"
do
this=$(( $this + 1 ))
@@ -345,17 +347,17 @@ split_patches () {
elsif (/^\# User /) { s/\# User/From:/ ; print ; }
elsif (/^\# Date /) {
my ($hashsign, $str, $time, $tz) = split ;
- $tz = sprintf "%+05d", (0-$tz)/36;
+ $tz_str = sprintf "%+05d", (0-$tz)/36;
print "Date: " .
strftime("%a, %d %b %Y %H:%M:%S ",
- localtime($time))
- . "$tz\n";
+ gmtime($time-$tz))
+ . "$tz_str\n";
} elsif (/^\# /) { next ; }
else {
print "\n", $_ ;
$subject = 1;
}
- ' <"$hg" >"$dotest/$msgnum" || clean_abort
+ ' -- "$hg" >"$dotest/$msgnum" || clean_abort
done
echo "$this" >"$dotest/last"
this=