Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2015-06-06 14:46:08 +0300
committerJunio C Hamano <gitster@pobox.com>2015-06-08 23:06:09 +0300
commit2c970c9ec3af9e162951a1b22d42c1a4dd9a8fed (patch)
tree7031a4f7b6c26e3207a5ee2308096f1e55818f86 /git-am.sh
parent88d5072466de2e0ba256a283eaaa6a79e31735a5 (diff)
am -3: support 3way merge on unborn branch
While on an unborn branch, git am -3 will fail to do a threeway merge as it references HEAD as "our tree", but HEAD does not point to a valid tree. Fix this by using an empty tree as "our tree" when we are on an unborn branch. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-am.sh')
-rwxr-xr-xgit-am.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-am.sh b/git-am.sh
index 80a7fdbd24..c5e139ff33 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -178,7 +178,8 @@ It does not apply to blobs recorded in its index.")"
then
GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
fi
- git-merge-recursive $orig_tree -- HEAD $his_tree || {
+ our_tree=$(git rev-parse --verify -q HEAD || echo $empty_tree)
+ git-merge-recursive $orig_tree -- $our_tree $his_tree || {
git rerere $allow_rerere_autoupdate
die "$(gettext "Failed to merge in the changes.")"
}