find_hook: keep our own static buffer
[gitweb.git] / git-am.sh
index 8733071624df86f21373db8c3e3cc5a1ece37830..3b770281232904132ac10620ded4a36d36a00be5 100755 (executable)
--- 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=
@@ -393,11 +395,6 @@ then
     keepcr=t
 fi
 
-if test "$(git config --bool --get am.threeWay)" = true
-then
-    threeway=t
-fi
-
 while test $# != 0
 do
        case "$1" in
@@ -409,8 +406,6 @@ it will be removed. Please do not use it anymore."
                ;;
        -3|--3way)
                threeway=t ;;
-       --no-3way)
-               threeway=f ;;
        -s|--signoff)
                sign=t ;;
        -u|--utf8)
@@ -680,8 +675,6 @@ fi
 if test "$(cat "$dotest/threeway")" = t
 then
        threeway=t
-else
-       threeway=f
 fi
 git_apply_opt=$(cat "$dotest/apply-opt")
 if test "$(cat "$dotest/sign")" = t