Skip to content

Commit a200337

Browse files
committed
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>
1 parent 1556ef1 commit a200337

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

git-am.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ It does not apply to blobs recorded in its index."
121121

122122
prec=4
123123
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=
125125
resolvemsg= resume=
126126
git_apply_opt=
127127

@@ -156,7 +156,7 @@ do
156156
--resolvemsg)
157157
shift; resolvemsg=$1 ;;
158158
--whitespace)
159-
ws="--whitespace=$2"; shift ;;
159+
git_apply_opt="$git_apply_opt $1=$2"; shift ;;
160160
-C|-p)
161161
git_apply_opt="$git_apply_opt $1$2"; shift ;;
162162
--)
@@ -247,10 +247,10 @@ else
247247
exit 1
248248
}
249249

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.
252252
# -3 and -i can and must be given when resuming.
253-
echo " $ws" >"$dotest/whitespace"
253+
echo " $git_apply_opt" >"$dotest/apply_opt_extra"
254254
echo "$sign" >"$dotest/sign"
255255
echo "$utf8" >"$dotest/utf8"
256256
echo "$keep" >"$dotest/keep"
@@ -283,7 +283,7 @@ if test "$(cat "$dotest/keep")" = t
283283
then
284284
keep=-k
285285
fi
286-
ws=$(cat "$dotest/whitespace")
286+
git_apply_opt=$(cat "$dotest/apply_opt_extra")
287287
if test "$(cat "$dotest/sign")" = t
288288
then
289289
SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
@@ -454,7 +454,7 @@ do
454454

455455
case "$resolved" in
456456
'')
457-
git apply $git_apply_opt $ws --index "$dotest/patch"
457+
git apply $git_apply_opt --index "$dotest/patch"
458458
apply_status=$?
459459
;;
460460
t)

0 commit comments

Comments
 (0)