addurl in direct mode
This commit is contained in:
parent
cfc8c8a52b
commit
248090064d
3 changed files with 10 additions and 4 deletions
|
@ -151,12 +151,13 @@ 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
|
cleanup file key hascontent = ifM (isDirect <&&> pure hascontent)
|
||||||
( do
|
( do
|
||||||
l <- calcGitLink file key
|
l <- calcGitLink file key
|
||||||
sha <- inRepo $ Git.HashObject.hashObject BlobObject l
|
sha <- inRepo $ Git.HashObject.hashObject BlobObject l
|
||||||
Annex.Queue.addUpdateIndex =<<
|
Annex.Queue.addUpdateIndex =<<
|
||||||
inRepo (Git.UpdateIndex.stageSymlink file sha)
|
inRepo (Git.UpdateIndex.stageSymlink file sha)
|
||||||
|
when hascontent $
|
||||||
logStatus key InfoPresent
|
logStatus key InfoPresent
|
||||||
return True
|
return True
|
||||||
, do
|
, do
|
||||||
|
|
|
@ -22,9 +22,10 @@ import qualified Option
|
||||||
import Types.Key
|
import Types.Key
|
||||||
import Types.KeySource
|
import Types.KeySource
|
||||||
import Config
|
import Config
|
||||||
|
import Annex.Content.Direct
|
||||||
|
|
||||||
def :: [Command]
|
def :: [Command]
|
||||||
def = [notDirect $ notBareRepo $ withOptions [fileOption, pathdepthOption] $
|
def = [notBareRepo $ withOptions [fileOption, pathdepthOption] $
|
||||||
command "addurl" (paramRepeating paramUrl) seek "add urls to annex"]
|
command "addurl" (paramRepeating paramUrl) seek "add urls to annex"]
|
||||||
|
|
||||||
fileOption :: Option
|
fileOption :: Option
|
||||||
|
@ -79,6 +80,8 @@ download url file = do
|
||||||
case k of
|
case k of
|
||||||
Nothing -> stop
|
Nothing -> stop
|
||||||
Just (key, _) -> do
|
Just (key, _) -> do
|
||||||
|
whenM isDirect $
|
||||||
|
void $ addAssociatedFile key file
|
||||||
moveAnnex key tmp
|
moveAnnex key tmp
|
||||||
setUrlPresent key url
|
setUrlPresent key url
|
||||||
next $ Command.Add.cleanup file key True
|
next $ Command.Add.cleanup file key True
|
||||||
|
@ -90,6 +93,8 @@ nodownload url file = do
|
||||||
if exists
|
if exists
|
||||||
then do
|
then do
|
||||||
let key = Backend.URL.fromUrl url size
|
let key = Backend.URL.fromUrl url size
|
||||||
|
whenM isDirect $
|
||||||
|
void $ addAssociatedFile key file
|
||||||
setUrlPresent key url
|
setUrlPresent key url
|
||||||
next $ Command.Add.cleanup file key False
|
next $ Command.Add.cleanup file key False
|
||||||
else do
|
else do
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -4,7 +4,7 @@ git-annex (3.20130105) UNRELEASED; urgency=low
|
||||||
* committer: Fix a file handle leak.
|
* committer: Fix a file handle leak.
|
||||||
* assistant: Make expensive transfer scan work fully in direct mode.
|
* assistant: Make expensive transfer scan work fully in direct mode.
|
||||||
* More commands work in direct mode repositories: find, whereis, move, copy,
|
* 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.
|
* sync: No longer automatically adds files in direct mode.
|
||||||
* assistant: Detect when system is not configured with a user name,
|
* assistant: Detect when system is not configured with a user name,
|
||||||
and set environment to prevent git from failing.
|
and set environment to prevent git from failing.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue