@matheusbsbs / matheus-bagliano / commits / 88f8f0a52b
Fork 0

[PATCH] Enable and fix support for base less merges.

Let the merge strategies handle the base less case if they are able to do it. It also fixes git-resolve.sh to die if no common ancestors exists, instead of doing the wrong thing. Furthermore, it contains a small independent fix for git-merge.sh and a fix for a base less code path in gitMergeCommon.py. With this it's possible to use git merge -s recursive 'merge message' A B to do a base less merge of A and B. [jc: Thanks Fredrik for fixing the brown-paper-bag in git-merge. I fixed a small typo in git-merge-resolve fix; 'test' equality check is spelled with single equal sign -- C-style double equal sign is bashism.] Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>

Fredrik Kuivinen committed Oct 3, 2005 at 08:13 UTC 88f8f0a52b2962452d89e854ad751283595473e4
3 files changed +9 -3
git-merge-resolve.sh
+6
@@ -31,6 +31,12 @@ case "$remotes" in
31 exit 2 ;;
32 esac
33
34 +# Give up if this is a baseless merge.
35 +if test '' = "$bases"
36 +then
37 + exit 2
38 +fi
39 +
40 git-update-index --refresh 2>/dev/null
41 git-read-tree -u -m $bases $head $remotes || exit 2
42 echo "Trying simple merge."
git-merge.sh
+2 -2
@@ -26,7 +26,7 @@ dropsave() {
26 savestate() {
27 # Stash away any local modifications.
28 git-diff-index -r -z --name-only $head |
29 - cpio -0 -o >"$GIR_DIR/MERGE_SAVE"
29 + cpio -0 -o >"$GIT_DIR/MERGE_SAVE"
30 }
31
32 restorestate() {
@@ -103,7 +103,7 @@ echo "$head" >"$GIT_DIR/ORIG_HEAD"
103
104 case "$#,$common" in
105 *,'')
106 - die "Unable to find common commit between $head_arg and $*"
106 + # No common ancestors found. We need a real merge.
107 ;;
108 1,"$1")
109 # If head can reach all the merge then we are up to date.
gitMergeCommon.py
+1 -1
@@ -213,7 +213,7 @@ def buildGraph(heads):
213
214 # Write the empty tree to the object database and return its SHA1
215 def writeEmptyTree():
216 - tmpIndex = os.environ['GIT_DIR'] + '/merge-tmp-index'
216 + tmpIndex = os.environ.get('GIT_DIR', '.git') + '/merge-tmp-index'
217 def delTmpIndex():
218 try:
219 os.unlink(tmpIndex)