summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-06 17:34:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-06 17:34:44 -0400
commit61a5b85864301ffa6915326e674a83c36c74afe7 (patch)
tree22f823a092e5822920b4259785a83413c1867533
parent89c3bf6269500c454de3c07a002971f45788f8bf (diff)
addurl in direct mode
-rw-r--r--Command/Add.hs5
-rw-r--r--Command/AddUrl.hs7
-rw-r--r--debian/changelog2
3 files changed, 10 insertions, 4 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 6d0ae2e1c..883be1b91 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -151,13 +151,14 @@ 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
+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)
- logStatus key InfoPresent
+ when hascontent $
+ logStatus key InfoPresent
return True
, do
_ <- link file key hascontent
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 9c6e8aa86..9197d6844 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -22,9 +22,10 @@ import qualified Option
import Types.Key
import Types.KeySource
import Config
+import Annex.Content.Direct
def :: [Command]
-def = [notDirect $ notBareRepo $ withOptions [fileOption, pathdepthOption] $
+def = [notBareRepo $ withOptions [fileOption, pathdepthOption] $
command "addurl" (paramRepeating paramUrl) seek "add urls to annex"]
fileOption :: Option
@@ -79,6 +80,8 @@ download url file = do
case k of
Nothing -> stop
Just (key, _) -> do
+ whenM isDirect $
+ void $ addAssociatedFile key file
moveAnnex key tmp
setUrlPresent key url
next $ Command.Add.cleanup file key True
@@ -90,6 +93,8 @@ nodownload url file = do
if exists
then do
let key = Backend.URL.fromUrl url size
+ whenM isDirect $
+ void $ addAssociatedFile key file
setUrlPresent key url
next $ Command.Add.cleanup file key False
else do
diff --git a/debian/changelog b/debian/changelog
index bfb8599e7..e05de2b2f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,7 +4,7 @@ git-annex (3.20130105) UNRELEASED; urgency=low
* committer: Fix a file handle leak.
* assistant: Make expensive transfer scan work fully in direct mode.
* More commands work in direct mode repositories: find, whereis, move, copy,
- drop, log, fsck, add.
+ drop, log, fsck, add, addurl.
* sync: No longer automatically adds files in direct mode.
* assistant: Detect when system is not configured with a user name,
and set environment to prevent git from failing.