git-am: do not fail if 3-way fallback succeeds.
The current one incorrectly stops there without committing. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Oct 13, 2005 at 11:46 UTC
73319032c8d2b2c73138d5caee1d2838fe1305d2
1 file changed
+12
-8
git-am.sh
+12
-8
@@ -296,15 +296,19 @@ do
296
git-apply --index "$dotest/patch"; apply_status=$?
297
if test $apply_status = 1 && test "$threeway" = t
298
then
299
- (fall_back_3way) || stop_here $this
300
-
301
- # Applying the patch to an earlier tree and merging the
302
- # result may have produced the same tree as ours.
303
- if test '' = "$(git-diff-index --cached --name-only -z HEAD)"
299
+ if (fall_back_3way)
300
then
305
- echo No changes -- Patch already applied.
306
- go_next
307
- continue
301
+ # Applying the patch to an earlier tree and merging the
302
+ # result may have produced the same tree as ours.
303
+ changed="$(git-diff-index --cached --name-only -z HEAD)"
304
+ if test '' = "$changed"
305
+ then
306
+ echo No changes -- Patch already applied.
307
+ go_next
308
+ continue
309
+ fi
310
+ # clear apply_status -- we have successfully merged.
311
+ apply_status=0
312
fi
313
fi
314
if test $apply_status != 0