Fix a merge case with files added in both heads but different
[stgit] / stgit / git.py
index 13f7b87..21d74dd 100644 (file)
@@ -629,6 +629,15 @@ def merge(base, head1, head2):
     # 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],