update for DiffTree type change (which fixes assistant in subdir confusion bug)

This commit is contained in:
Joey Hess 2013-10-17 15:11:21 -04:00
parent c7b8c776a8
commit 19816bca41
4 changed files with 16 additions and 9 deletions

View file

@ -101,7 +101,7 @@ addAssociatedFile key file = do
else file':files
{- Associated files are always stored relative to the top of the repository.
- The input FilePath is relative to the CWD. -}
- The input FilePath is relative to the CWD, or is absolute. -}
normaliseAssociatedFile :: FilePath -> Annex FilePath
normaliseAssociatedFile file = do
top <- fromRepo Git.repoPath

View file

@ -13,6 +13,7 @@ import qualified Git.LsFiles
import qualified Git.Merge
import qualified Git.DiffTree as DiffTree
import Git.Sha
import Git.FilePath
import Git.Types
import Annex.CatFile
import qualified Annex.Queue
@ -136,22 +137,22 @@ mergeDirect d branch g = do
mergeDirectCleanup :: FilePath -> Git.Ref -> Git.Ref -> Annex ()
mergeDirectCleanup d oldsha newsha = do
(items, cleanup) <- inRepo $ DiffTree.diffTreeRecursive oldsha newsha
forM_ items updated
makeabs <- flip fromTopFilePath <$> gitRepo
forM_ items (updated makeabs)
void $ liftIO cleanup
liftIO $ removeDirectoryRecursive d
where
updated item = do
updated makeabs item = do
let f = makeabs (DiffTree.file item)
void $ tryAnnex $
go DiffTree.srcsha DiffTree.srcmode moveout moveout_raw
go f DiffTree.srcsha DiffTree.srcmode moveout moveout_raw
void $ tryAnnex $
go DiffTree.dstsha DiffTree.dstmode movein movein_raw
go f DiffTree.dstsha DiffTree.dstmode movein movein_raw
where
go getsha getmode a araw
go f getsha getmode a araw
| getsha item == nullSha = noop
| otherwise =
maybe (araw f) (\k -> void $ a k f)
| otherwise = maybe (araw f) (\k -> void $ a k f)
=<< catKey (getsha item) (getmode item)
f = DiffTree.file item
moveout = removeDirect

3
debian/changelog vendored
View file

@ -26,6 +26,9 @@ git-annex (4.20131003) UNRELEASED; urgency=low
* sync: Fix automatic resolution of merge conflicts where one side is an
annexed file, and the other side is a non-annexed file, or a directory.
* S3: Try to ensure bucket name is valid for archive.org.
* assistant: Bug fix: When run in a subdirectory, files from incoming merges
were wrongly added to that subdirectory, and removed from their original
locations.
-- Joey Hess <joeyh@debian.org> Thu, 03 Oct 2013 15:41:24 -0400

View file

@ -32,3 +32,6 @@ tree, which its code actually assumes is the case.
The assistant, however, does not do that, and it's useful in general to
only run it in a subdir.
> Made sync merge code handle this correctly. Conflicted merge handing code
> was already ok. [[fixed|done]] --[[Joey]]