test suite passes in direct mode

This fixes a bug with git annex add in direct mode. If some files already
existed in the tree pointing at the same key as a file that was just added,
and their content was not present, add neglected to copy the content to
those files.

I also changed the behavior of moveAnnex slightly: When content is moved
into the annex in direct mode, it does not overwrite any content already
present in direct mode files. That content may be modified after all.
This commit is contained in:
Joey Hess 2013-05-17 15:59:37 -04:00
parent 90d44f09eb
commit b8e5b9c645
6 changed files with 63 additions and 31 deletions

View file

@ -26,6 +26,7 @@ import Annex.Link
import Utility.InodeCache
import Utility.CopyFile
import Annex.Perms
import Annex.ReplaceFile
{- Uses git ls-files to find files that need to be committed, and stages
- them into the index. Returns True if some changes were staged. -}
@ -191,7 +192,7 @@ toDirectGen k f = do
{- Move content from annex to direct file. -}
thawContentDir loc
updateInodeCache k loc
addAssociatedFile k f
void $ addAssociatedFile k f
thawContent loc
replaceFile f $ liftIO . moveFile loc
fromdirect = do