summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-11-29 15:45:29 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-11-29 15:45:29 -0400
commitec8d3f61bd4cd1432757fd8fe185ba8f35791755 (patch)
treed90869d10170049c64841e100d6eb78ccc980f75 /Command
parent766e8409edca65a44fa0466e341b7f6b58117535 (diff)
parent7378d141f263aaba0c0ec1e2f84285ffd2fbf0e2 (diff)
Merge branch 'master' into tor
Diffstat (limited to 'Command')
-rw-r--r--Command/AddUrl.hs17
-rw-r--r--Command/ReKey.hs2
-rw-r--r--Command/Schedule.hs2
3 files changed, 13 insertions, 8 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index e32ceb568..e49d2727c 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -340,13 +340,18 @@ cleanup :: UUID -> URLString -> FilePath -> Key -> Maybe FilePath -> Annex ()
cleanup u url file key mtmp = case mtmp of
Nothing -> go
Just tmp -> do
+ -- Move to final location for large file check.
+ liftIO $ renameFile tmp file
largematcher <- largeFilesMatcher
- ifM (checkFileMatcher largematcher file)
- ( go
- , do
- liftIO $ renameFile tmp file
- void $ Command.Add.addSmall file
- )
+ large <- checkFileMatcher largematcher file
+ if large
+ then do
+ -- Move back to tmp because addAnnexedFile
+ -- needs the file in a different location
+ -- than the work tree file.
+ liftIO $ renameFile file tmp
+ go
+ else void $ Command.Add.addSmall file
where
go = do
maybeShowJSON $ JSONChunk [("key", key2file key)]
diff --git a/Command/ReKey.hs b/Command/ReKey.hs
index 51f9f6fe1..33734ebe7 100644
--- a/Command/ReKey.hs
+++ b/Command/ReKey.hs
@@ -44,7 +44,7 @@ perform :: FilePath -> Key -> Key -> CommandPerform
perform file oldkey newkey = do
ifM (inAnnex oldkey)
( unlessM (linkKey file oldkey newkey) $
- error "failed"
+ giveup "failed"
, unlessM (Annex.getState Annex.force) $
giveup $ file ++ " is not available (use --force to override)"
)
diff --git a/Command/Schedule.hs b/Command/Schedule.hs
index 5cc8b37bf..c9d4f915f 100644
--- a/Command/Schedule.hs
+++ b/Command/Schedule.hs
@@ -29,7 +29,7 @@ start = parse
where
parse (name:[]) = go name performGet
parse (name:expr:[]) = go name $ \uuid -> do
- showStart "schedile" name
+ showStart "schedule" name
performSet expr uuid
parse _ = giveup "Specify a repository."