summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-05 13:41:48 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-05 13:41:48 -0400
commit618c9513f5599fe89be1624e6379818f05f9925b (patch)
tree58f8000f1bab1b14c012d6092a31844f3d466b65
parent7c9513f161dd6b3671747c6f54c7a259bafb155c (diff)
assistant: Fix location log when adding new file in direct mode.
-rw-r--r--Assistant/Threads/Committer.hs21
-rw-r--r--Command/Add.hs38
-rw-r--r--debian/changelog1
3 files changed, 31 insertions, 29 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index c11c6667e..3d0148b02 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -18,6 +18,7 @@ import Assistant.DaemonStatus
import Assistant.Threads.Watcher
import Assistant.TransferQueue
import Logs.Transfer
+import Logs.Location
import qualified Annex.Queue
import qualified Git.Command
import qualified Git.HashObject
@@ -204,15 +205,17 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
liftAnnex showEndFail
return Nothing
done change file (Just key) = do
- link <- liftAnnex $ ifM isDirect
- ( calcGitLink file key
- , Command.Add.link file key True
- )
- liftAnnex $ whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $ do
- sha <- inRepo $
- Git.HashObject.hashObject BlobObject link
- stageSymlink file sha
- showEndOk
+ liftAnnex $ do
+ logStatus key InfoPresent
+ link <- ifM isDirect
+ ( calcGitLink file key
+ , Command.Add.link file key True
+ )
+ whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $ do
+ sha <- inRepo $
+ Git.HashObject.hashObject BlobObject link
+ stageSymlink file sha
+ showEndOk
queueTransfers Next key (Just file) Upload
return $ Just change
diff --git a/Command/Add.hs b/Command/Add.hs
index 1bc38eecd..a68b190de 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -142,8 +142,6 @@ link file key hascontent = handle (undo file key) $ do
liftIO $ createSymbolicLink l file
when hascontent $ do
- logStatus key InfoPresent
-
-- touch the symlink to have the same mtime as the
-- file it points to
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
- create the symlink and add it. -}
cleanup :: FilePath -> Key -> Bool -> CommandCleanup
-cleanup file key hascontent = ifM (isDirect <&&> pure hascontent)
- ( do
- l <- calcGitLink file key
- sha <- inRepo $ Git.HashObject.hashObject BlobObject l
- Annex.Queue.addUpdateIndex =<<
- inRepo (Git.UpdateIndex.stageSymlink file sha)
- when hascontent $
- logStatus key InfoPresent
- return True
- , do
- _ <- link file key hascontent
- params <- ifM (Annex.getState Annex.force)
- ( return [Param "-f"]
- , return []
- )
- Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
- return True
- )
+cleanup file key hascontent = do
+ when hascontent $
+ logStatus key InfoPresent
+ ifM (isDirect <&&> pure hascontent)
+ ( do
+ l <- calcGitLink file key
+ sha <- inRepo $ Git.HashObject.hashObject BlobObject l
+ Annex.Queue.addUpdateIndex =<<
+ inRepo (Git.UpdateIndex.stageSymlink file sha)
+ , do
+ _ <- link file key hascontent
+ params <- ifM (Annex.getState Annex.force)
+ ( return [Param "-f"]
+ , return []
+ )
+ Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
+ )
+ return True
diff --git a/debian/changelog b/debian/changelog
index 2bab763b2..05ceb00b9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ git-annex (3.20130125) UNRELEASED; urgency=low
of changed files by the assistant, while it still does data syncing
and other tasks.
* 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