Since using git-merge-recursive instead of git-read-tree, the local
file is removed if it was added in both heads but different. We now
re-generated it in gitmergeonefile.merge. The patch also cleans the
working directory of extra files generated by git-merge-recursive
since our own merge re-generates them with nicer naming.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
# merge the unmerged files
errors = False
for path in files:
+ # remove additional files that might be generated for some
+ # newer versions of GIT
+ for suffix in [base, head1, head2]:
+ if not suffix:
+ continue
+ fname = path + '~' + suffix
+ if os.path.exists(fname):
+ os.remove(fname)
+
stages = files[path]
if gitmergeonefile.merge(stages['1'][1], stages['2'][1],
stages['3'][1], path, stages['1'][0],
os.chmod(tmp, int(file2_mode, 8))
os.renames(tmp, src2)
+ if file1_hash and not os.path.exists(path):
+ # the current file might be removed by GIT when it is a new
+ # file added in both branches. Just re-generate it
+ tmp = __output('git-unpack-file %s' % file1_hash)
+ os.chmod(tmp, int(file1_mode, 8))
+ os.renames(tmp, path)
+
def __remove_files(orig_hash, file1_hash, file2_hash):
"""Remove any temporary files
"""
os.remove(src1)
if file2_hash:
os.remove(src2)
- pass
def __conflict(path):
"""Write the conflict file for the 'path' variable and exit