summaryrefslogtreecommitdiff
path: root/Command/Unannex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-06 14:02:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-06 14:02:18 -0400
commiteadcb2d93f5ed2ec280efede40c623c7a5394678 (patch)
tree08392ca077dc1825e506565fc6c7a12589aee4f1 /Command/Unannex.hs
parentf4ced8dd9f70fe46e4c8c34acb58e28aff009907 (diff)
uninit, unannex --fast: If hard link creation fails, fall back to slow mode.
Diffstat (limited to 'Command/Unannex.hs')
-rw-r--r--Command/Unannex.hs22
1 files changed, 14 insertions, 8 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index c5ab028cd..0e691710a 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -49,14 +49,20 @@ cleanup file key = do
void $ liftIO clean
ifM (Annex.getState Annex.fast)
- ( do
- -- fast mode: hard link to content in annex
- src <- inRepo $ gitAnnexLocation key
- liftIO $ createLink src file
- thawContent file
- , do
- fromAnnex key file
- logStatus key InfoMissing
+ ( goFast
+ , go
)
return True
+ where
+ goFast = do
+ -- fast mode: hard link to content in annex
+ src <- inRepo $ gitAnnexLocation key
+ -- creating a hard link could fall; fall back to non fast mode
+ ifM (liftIO $ catchBoolIO $ createLink src file >> return True)
+ ( thawContent file
+ , go
+ )
+ go = do
+ fromAnnex key file
+ logStatus key InfoMissing