summaryrefslogtreecommitdiff
path: root/git-merge-recursive.py
diff options
context:
space:
mode:
authorFredrik Kuivinen <freku045@student.liu.se>2005-09-13 23:41:16 +0200
committerJunio C Hamano <junkio@cox.net>2005-09-13 15:45:25 -0700
commit6511cce24b932eba33d8e13b54664673121a8b7e (patch)
treef3c477670b0fa7dd3fc9738b08e7e7b3f7ae1d63 /git-merge-recursive.py
parent87a71b65acc10c4879b13d2030185e5640a087cd (diff)
downloadgit-6511cce24b932eba33d8e13b54664673121a8b7e.tar.gz
[PATCH] Use a temporary index file when we merge the common ancestors.
With this change we can get rid of a call to 'git-update-index --refresh'. Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-merge-recursive.py')
-rwxr-xr-xgit-merge-recursive.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/git-merge-recursive.py b/git-merge-recursive.py
index ea7f994a4f..66165b01ce 100755
--- a/git-merge-recursive.py
+++ b/git-merge-recursive.py
@@ -10,6 +10,22 @@ from gitMergeCommon import *
# The actual merge code
# ---------------------
+originalIndexFile = os.environ.get('GIT_INDEX_FILE',
+ os.environ.get('GIT_DIR', '.git') + '/index')
+temporaryIndexFile = os.environ.get('GIT_DIR', '.git') + \
+ '/merge-recursive-tmp-index'
+def setupIndex(temporary):
+ try:
+ os.unlink(temporaryIndexFile)
+ except OSError:
+ pass
+ if temporary:
+ newIndex = temporaryIndexFile
+ os.environ
+ else:
+ newIndex = originalIndexFile
+ os.environ['GIT_INDEX_FILE'] = newIndex
+
def merge(h1, h2, branch1Name, branch2Name, graph, callDepth=0):
'''Merge the commits h1 and h2, return the resulting virtual
commit object and a flag indicating the cleaness of the merge.'''
@@ -39,13 +55,10 @@ def merge(h1, h2, branch1Name, branch2Name, graph, callDepth=0):
assert(isinstance(Ms, Commit))
if callDepth == 0:
- if len(ca) > 1:
- runProgram(['git-read-tree', h1.tree()])
- runProgram(['git-update-index', '-q', '--refresh'])
- # Use the original index if we only have one common ancestor
-
+ setupIndex(False)
cleanCache = False
else:
+ setupIndex(True)
runProgram(['git-read-tree', h1.tree()])
cleanCache = True