diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-23 18:09:00 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-23 18:09:00 -0400 |
commit | 928d24696dcf655a2c8ffff264b40050945c6c2d (patch) | |
tree | 1416908c864f79690e95658743d7cb411209977d /Command | |
parent | d461a4d775ed14c6f0e90cd4416bbb2c4ce83547 (diff) |
show a message to tell why adding a file failed
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index fa7d48544..68a894d30 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -122,7 +122,7 @@ ingest (Just source) = do case (cache, inodeCache source) of (_, Nothing) -> go k cache (Just newc, Just c) | compareStrong c newc -> go k cache - _ -> failure + _ -> failure "changed while it was being added" where go k cache = ifM isDirect ( godirect k cache , goindirect k cache ) @@ -131,15 +131,16 @@ ingest (Just source) = do moveAnnex key $ contentLocation source liftIO $ nukeFile $ keyFilename source return $ Just key - goindirect Nothing _ = failure + goindirect Nothing _ = failure "failed to generate a key" godirect (Just (key, _)) (Just cache) = do addInodeCache key cache finishIngestDirect key source return $ Just key - godirect _ _ = failure + godirect _ _ = failure "failed to generate a key" - failure = do + failure msg = do + warning $ keyFilename source ++ " " ++ msg when (contentLocation source /= keyFilename source) $ liftIO $ nukeFile $ contentLocation source return Nothing |