Skip to content

Commit

Permalink
[PATCH] Use a temporary index file when we merge the common ancestors.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fredrik Kuivinen authored and Junio C Hamano committed Sep 13, 2005
1 parent 87a71b6 commit 6511cce
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions git-merge-recursive.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
# 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.'''
Expand Down Expand Up @@ -39,13 +55,10 @@ def infoMsg(*args):
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

Expand Down

0 comments on commit 6511cce

Please sign in to comment.