Merge branch 'sh/write-pack-file-warning-message-fix'
[gitweb.git] / git-am.sh
index bbea43075be030c272ef0d8e4cb9c25a179d4e53..78517f254f7e772145ff419bb3f000507458ff60 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -4,6 +4,7 @@
 
 SUBDIRECTORY_OK=Yes
 OPTIONS_KEEPDASHDASH=
+OPTIONS_STUCKLONG=t
 OPTIONS_SPEC="\
 git am [options] [(<mbox>|<Maildir>)...]
 git am [options] (--continue | --skip | --abort)
@@ -37,6 +38,7 @@ abort           restore the original branch and abort the patching operation.
 committer-date-is-author-date    lie about committer date
 ignore-date     use current timestamp for author date
 rerere-autoupdate update the index with reused conflict resolution if possible
+S,gpg-sign?     GPG-sign commits
 rebasing*       (internal use for git-rebase)"
 
 . git-sh-setup
@@ -374,6 +376,7 @@ git_apply_opt=
 committer_date_is_author_date=
 ignore_date=
 allow_rerere_autoupdate=
+gpg_sign_opt=
 
 if test "$(git config --bool --get am.keepcr)" = true
 then
@@ -413,14 +416,14 @@ it will be removed. Please do not use it anymore."
                abort=t ;;
        --rebasing)
                rebasing=t threeway=t ;;
-       --resolvemsg)
-               shift; resolvemsg=$1 ;;
-       --whitespace|--directory|--exclude|--include)
-               git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
-       -C|-p)
-               git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
-       --patch-format)
-               shift ; patch_format="$1" ;;
+       --resolvemsg=*)
+               resolvemsg="${1#--resolvemsg=}" ;;
+       --whitespace=*|--directory=*|--exclude=*|--include=*)
+               git_apply_opt="$git_apply_opt $(sq "$1")" ;;
+       -C*|-p*)
+               git_apply_opt="$git_apply_opt $(sq "$1")" ;;
+       --patch-format=*)
+               patch_format="${1#--patch-format=}" ;;
        --reject|--ignore-whitespace|--ignore-space-change)
                git_apply_opt="$git_apply_opt $1" ;;
        --committer-date-is-author-date)
@@ -435,6 +438,10 @@ it will be removed. Please do not use it anymore."
                keepcr=t ;;
        --no-keep-cr)
                keepcr=f ;;
+       --gpg-sign)
+               gpg_sign_opt=-S ;;
+       --gpg-sign=*)
+               gpg_sign_opt="-S${1#--gpg-sign=}" ;;
        --)
                shift; break ;;
        *)
@@ -899,7 +906,8 @@ did you forget to use 'git add'?"
                        GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
                        export GIT_COMMITTER_DATE
                fi &&
-               git commit-tree $tree ${parent:+-p} $parent <"$dotest/final-commit"
+               git commit-tree ${parent:+-p} $parent ${gpg_sign_opt:+"$gpg_sign_opt"} $tree  \
+                       <"$dotest/final-commit"
        ) &&
        git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent ||
        stop_here $this