Code

Teach git-am to pass -p option down to git-apply
[git.git] / git-am.sh
index 1252f26bbd46484f25e58e92680e553f7fd7c1da..6db9cb503a2717d0c45ee40e262747cbeba3ad17 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -3,7 +3,7 @@
 # Copyright (c) 2005, 2006 Junio C Hamano
 
 USAGE='[--signoff] [--dotest=<dir>] [--utf8 | --no-utf8] [--binary] [--3way]
-  [--interactive] [--whitespace=<option>] <mbox>...
+  [--interactive] [--whitespace=<option>] [-C<n>] [-p<n>] <mbox>...
   or, when resuming [--skip | --resolved]'
 . git-sh-setup
 set_reflog_action am
@@ -106,7 +106,8 @@ It does not apply to blobs recorded in its index."
 }
 
 prec=4
-dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= ws= resolvemsg=
+dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= resolvemsg=
+git_apply_opt=
 
 while case "$#" in 0) break;; esac
 do
@@ -141,8 +142,8 @@ do
        --sk|--ski|--skip)
        skip=t; shift ;;
 
-       --whitespace=*)
-       ws=$1; shift ;;
+       --whitespace=*|-C*|-p*)
+       git_apply_opt="$git_apply_opt $1"; shift ;;
 
        --resolvemsg=*)
        resolvemsg=$(echo "$1" | sed -e "s/^--resolvemsg=//"); shift ;;
@@ -394,7 +395,7 @@ do
 
        case "$resolved" in
        '')
-               git-apply $binary --index $ws "$dotest/patch"
+               git-apply $git_apply_opt $binary --index "$dotest/patch"
                apply_status=$?
                ;;
        t)