From eadcb2d93f5ed2ec280efede40c623c7a5394678 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 6 Feb 2013 14:02:18 -0400 Subject: uninit, unannex --fast: If hard link creation fails, fall back to slow mode. --- Command/Unannex.hs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'Command/Unannex.hs') 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 -- cgit v1.2.3