avoid making post-merge-conflict-resolution commit when no conflicts were resolved

sync, merge, assistant: When git merge failed for a reason other than a
conflicted merge, such as a crippled filesystem not allowing particular
characters in filenames, git-annex would make a merge commit that could
omit such files or otherwise be bad. Fixed by aborting the whole merge
process when git merge fails for any reason other than a merge conflict.
This commit is contained in:
Joey Hess 2015-10-15 14:22:46 -04:00
parent 238728362f
commit 27eaa6f410
Failed to extract signature
3 changed files with 19 additions and 7 deletions

View file

@ -173,16 +173,18 @@ mergeDirect startbranch oldref branch resolvemerge commitmode = exclusively $ do
withIndexFile tmpi $ do
merged <- stageMerge d branch commitmode
r <- if merged
ok <- if merged
then return True
else resolvemerge
mergeDirectCleanup d (fromMaybe Git.Sha.emptyTree oldref)
mergeDirectCommit merged startbranch branch commitmode
if ok
then do
mergeDirectCleanup d (fromMaybe Git.Sha.emptyTree oldref)
mergeDirectCommit merged startbranch branch commitmode
liftIO $ whenM (doesFileExist tmpi) $
rename tmpi reali
else liftIO $ nukeFile tmpi
liftIO $ whenM (doesFileExist tmpi) $
rename tmpi reali
return r
return ok
where
exclusively = withExclusiveLock gitAnnexMergeLock