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:
parent
238728362f
commit
27eaa6f410
3 changed files with 19 additions and 7 deletions
|
@ -77,6 +77,10 @@ autoMergeFrom branch currbranch commitmode = do
|
||||||
- In direct mode, the work tree is not touched here; files are staged to
|
- In direct mode, the work tree is not touched here; files are staged to
|
||||||
- the index, and written to the gitAnnexMergeDir, for later handling by
|
- the index, and written to the gitAnnexMergeDir, for later handling by
|
||||||
- the direct mode merge code.
|
- the direct mode merge code.
|
||||||
|
-
|
||||||
|
- Returns false when there are no merge conflicts to resolve.
|
||||||
|
- A git merge can fail for other reasons, and this allows detecting
|
||||||
|
- such failures.
|
||||||
-}
|
-}
|
||||||
resolveMerge :: Maybe Git.Ref -> Git.Ref -> Annex Bool
|
resolveMerge :: Maybe Git.Ref -> Git.Ref -> Annex Bool
|
||||||
resolveMerge us them = do
|
resolveMerge us them = do
|
||||||
|
|
|
@ -173,16 +173,18 @@ mergeDirect startbranch oldref branch resolvemerge commitmode = exclusively $ do
|
||||||
|
|
||||||
withIndexFile tmpi $ do
|
withIndexFile tmpi $ do
|
||||||
merged <- stageMerge d branch commitmode
|
merged <- stageMerge d branch commitmode
|
||||||
r <- if merged
|
ok <- if merged
|
||||||
then return True
|
then return True
|
||||||
else resolvemerge
|
else resolvemerge
|
||||||
|
if ok
|
||||||
|
then do
|
||||||
mergeDirectCleanup d (fromMaybe Git.Sha.emptyTree oldref)
|
mergeDirectCleanup d (fromMaybe Git.Sha.emptyTree oldref)
|
||||||
mergeDirectCommit merged startbranch branch commitmode
|
mergeDirectCommit merged startbranch branch commitmode
|
||||||
|
|
||||||
liftIO $ whenM (doesFileExist tmpi) $
|
liftIO $ whenM (doesFileExist tmpi) $
|
||||||
rename tmpi reali
|
rename tmpi reali
|
||||||
|
else liftIO $ nukeFile tmpi
|
||||||
|
|
||||||
return r
|
return ok
|
||||||
where
|
where
|
||||||
exclusively = withExclusiveLock gitAnnexMergeLock
|
exclusively = withExclusiveLock gitAnnexMergeLock
|
||||||
|
|
||||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -36,6 +36,12 @@ git-annex (5.20150931) UNRELEASED; urgency=medium
|
||||||
* Avoid unncessary write to the location log when a file is unlocked
|
* Avoid unncessary write to the location log when a file is unlocked
|
||||||
and then added back with unchanged content.
|
and then added back with unchanged content.
|
||||||
* S3: Fix support for using https.
|
* S3: Fix support for using https.
|
||||||
|
* 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.
|
||||||
* Debian: Add torrent library to build-depends as it's packaged now,
|
* Debian: Add torrent library to build-depends as it's packaged now,
|
||||||
and stop recommending bittornado | bittorrent.
|
and stop recommending bittornado | bittorrent.
|
||||||
* Debian: Remove dependency on transformers library, as it is now
|
* Debian: Remove dependency on transformers library, as it is now
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue