From 47f0b6d5d49247b85898083d1ccf4f899ef7294a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 6 Oct 2005 14:25:52 -0700 Subject: 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 --- git-applymbox.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'git-applymbox.sh') diff --git a/git-applymbox.sh b/git-applymbox.sh index e2bfd02870..a83246cad8 100755 --- a/git-applymbox.sh +++ b/git-applymbox.sh @@ -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/ | mbox) [signoff]" + echo >&2 "applymbox [-u] [-k] [-q] [-m] (-c .dotest/ | 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 ;; esac @@ -56,6 +55,9 @@ fi case "$query_apply" in t) touch .dotest/.query_apply esac +case "$fall_back_3way" in +t) : >.dotest/.3way +esac case "$keep_subject" in -k) : >.dotest/.keep_subject esac -- cgit v1.2.3