@matheusbsbs / matheus-bagliano / commits / a20033796b
Fork 0

git-am: propagate -C<n>, -p<n> options as well

These options are meant to deal with patches that do not apply cleanly due to the differences between the version the patch was based on and the version "git am" is working on. Because a series of patches applied in the same "git am" run tends to come from the same source, it is more useful to propagate these options after the application stops. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Dec 4, 2008 at 15:38 UTC a20033796b312390ea8a50917bea623efd6fad97
1 file changed +7 -7
git-am.sh
+7 -7
@@ -121,7 +121,7 @@ It does not apply to blobs recorded in its index."
121
122 prec=4
123 dotest="$GIT_DIR/rebase-apply"
124 -sign= utf8=t keep= skip= interactive= resolved= rebasing= abort= ws=
124 +sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
125 resolvemsg= resume=
126 git_apply_opt=
127
@@ -156,7 +156,7 @@ do
156 --resolvemsg)
157 shift; resolvemsg=$1 ;;
158 --whitespace)
159 - ws="--whitespace=$2"; shift ;;
159 + git_apply_opt="$git_apply_opt $1=$2"; shift ;;
160 -C|-p)
161 git_apply_opt="$git_apply_opt $1$2"; shift ;;
162 --)
@@ -247,10 +247,10 @@ else
247 exit 1
248 }
249
250 - # -s, -u, -k and --whitespace flags are kept for the
251 - # resuming session after a patch failure.
250 + # -s, -u, -k, --whitespace, -C and -p flags are kept
251 + # for the resuming session after a patch failure.
252 # -3 and -i can and must be given when resuming.
253 - echo " $ws" >"$dotest/whitespace"
253 + echo " $git_apply_opt" >"$dotest/apply_opt_extra"
254 echo "$sign" >"$dotest/sign"
255 echo "$utf8" >"$dotest/utf8"
256 echo "$keep" >"$dotest/keep"
@@ -283,7 +283,7 @@ if test "$(cat "$dotest/keep")" = t
283 then
284 keep=-k
285 fi
286 -ws=$(cat "$dotest/whitespace")
286 +git_apply_opt=$(cat "$dotest/apply_opt_extra")
287 if test "$(cat "$dotest/sign")" = t
288 then
289 SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
@@ -454,7 +454,7 @@ do
454
455 case "$resolved" in
456 '')
457 - git apply $git_apply_opt $ws --index "$dotest/patch"
457 + git apply $git_apply_opt --index "$dotest/patch"
458 apply_status=$?
459 ;;
460 t)