assistant: Fix location log when adding new file in direct mode.

This commit is contained in:
Joey Hess 2013-02-05 13:41:48 -04:00
parent 25c47ae84f
commit b19c2e6122
3 changed files with 31 additions and 29 deletions

View file

@ -18,6 +18,7 @@ import Assistant.DaemonStatus
import Assistant.Threads.Watcher import Assistant.Threads.Watcher
import Assistant.TransferQueue import Assistant.TransferQueue
import Logs.Transfer import Logs.Transfer
import Logs.Location
import qualified Annex.Queue import qualified Annex.Queue
import qualified Git.Command import qualified Git.Command
import qualified Git.HashObject import qualified Git.HashObject
@ -204,15 +205,17 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
liftAnnex showEndFail liftAnnex showEndFail
return Nothing return Nothing
done change file (Just key) = do done change file (Just key) = do
link <- liftAnnex $ ifM isDirect liftAnnex $ do
( calcGitLink file key logStatus key InfoPresent
, Command.Add.link file key True link <- ifM isDirect
) ( calcGitLink file key
liftAnnex $ whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $ do , Command.Add.link file key True
sha <- inRepo $ )
Git.HashObject.hashObject BlobObject link whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $ do
stageSymlink file sha sha <- inRepo $
showEndOk Git.HashObject.hashObject BlobObject link
stageSymlink file sha
showEndOk
queueTransfers Next key (Just file) Upload queueTransfers Next key (Just file) Upload
return $ Just change return $ Just change

View file

@ -142,8 +142,6 @@ link file key hascontent = handle (undo file key) $ do
liftIO $ createSymbolicLink l file liftIO $ createSymbolicLink l file
when hascontent $ do when hascontent $ do
logStatus key InfoPresent
-- touch the symlink to have the same mtime as the -- touch the symlink to have the same mtime as the
-- file it points to -- file it points to
liftIO $ do liftIO $ do
@ -155,21 +153,21 @@ link file key hascontent = handle (undo file key) $ do
{- Note: Several other commands call this, and expect it to {- Note: Several other commands call this, and expect it to
- create the symlink and add it. -} - create the symlink and add it. -}
cleanup :: FilePath -> Key -> Bool -> CommandCleanup cleanup :: FilePath -> Key -> Bool -> CommandCleanup
cleanup file key hascontent = ifM (isDirect <&&> pure hascontent) cleanup file key hascontent = do
( do when hascontent $
l <- calcGitLink file key logStatus key InfoPresent
sha <- inRepo $ Git.HashObject.hashObject BlobObject l ifM (isDirect <&&> pure hascontent)
Annex.Queue.addUpdateIndex =<< ( do
inRepo (Git.UpdateIndex.stageSymlink file sha) l <- calcGitLink file key
when hascontent $ sha <- inRepo $ Git.HashObject.hashObject BlobObject l
logStatus key InfoPresent Annex.Queue.addUpdateIndex =<<
return True inRepo (Git.UpdateIndex.stageSymlink file sha)
, do , do
_ <- link file key hascontent _ <- link file key hascontent
params <- ifM (Annex.getState Annex.force) params <- ifM (Annex.getState Annex.force)
( return [Param "-f"] ( return [Param "-f"]
, return [] , return []
) )
Annex.Queue.addCommand "add" (params++[Param "--"]) [file] Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
return True )
) return True

1
debian/changelog vendored
View file

@ -8,6 +8,7 @@ git-annex (3.20130125) UNRELEASED; urgency=low
of changed files by the assistant, while it still does data syncing of changed files by the assistant, while it still does data syncing
and other tasks. and other tasks.
* assistant: Ignore .DS_Store on OSX. * assistant: Ignore .DS_Store on OSX.
* assistant: Fix location log when adding new file in direct mode.
-- Joey Hess <joeyh@debian.org> Sat, 26 Jan 2013 15:48:40 +1100 -- Joey Hess <joeyh@debian.org> Sat, 26 Jan 2013 15:48:40 +1100