path: root/
diff options
authorJunio C Hamano <>2005-10-06 21:25:52 (GMT)
committerJunio C Hamano <>2005-10-06 21:25:52 (GMT)
commit47f0b6d5d49247b85898083d1ccf4f899ef7294a (patch)
treef69393968e164e20c33142923ec563eb75252583 /
parentbc162e40ea6dc3208e3bda76301d6409607ed3ff (diff)
Fall back to three-way merge when applying a patch.
After git-apply fails, attempt to find a base tree that the patch cleanly applies to, and do a three-way merge using that base tree into the current index, if .dotest/.3way file exists. This flag can be controlled by giving -m flag to git-applymbox command. When the fall-back merge fails, the working tree can be resolved the same way as you would normally hand resolve a conflicting merge. When making commit, use .dotest/final-commit as the log message template. Or you could just choose to 'git-checkout-index -f -a' to revert the failed merge. Signed-off-by: Junio C Hamano <>
Diffstat (limited to '')
1 files changed, 5 insertions, 3 deletions
diff --git a/ b/
index e2bfd02..a83246c 100755
--- a/
+++ b/
@@ -9,8 +9,6 @@
## You give it a mbox-format collection of emails, and it will try to
## apply them to the kernel using "applypatch"
-## applymbox [-u] [-k] [-q] (-c .dotest/msg-number | mail_archive) [Signoff_file]"
## The patch application may fail in the middle. In which case:
## (1) look at .dotest/patch and fix it up to apply
## (2) re-run applymbox with -c .dotest/msg-number for the current one.
@@ -21,7 +19,7 @@
. git-sh-setup || die "Not a git archive"
usage () {
- echo >&2 "applymbox [-u] [-k] [-q] (-c .dotest/<num> | mbox) [signoff]"
+ echo >&2 "applymbox [-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]"
exit 1
@@ -33,6 +31,7 @@ do
-k) keep_subject=-k ;;
-q) query_apply=t ;;
-c) continue="$2"; resume=f; shift ;;
+ -m) fallback_3way=t ;;
-*) usage ;;
*) break ;;
@@ -56,6 +55,9 @@ fi
case "$query_apply" in
t) touch .dotest/.query_apply
+case "$fall_back_3way" in
+t) : >.dotest/.3way
case "$keep_subject" in
-k) : >.dotest/.keep_subject