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 ++++++++++++++-------- debian/changelog | 2 ++ ...es_not_abort_when_hard_link_creation_fails.mdwn | 6 ++++++ 3 files changed, 22 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 diff --git a/debian/changelog b/debian/changelog index e67147f3d..f5ae18543 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ git-annex (3.20130125) UNRELEASED; urgency=low * assistant: Fix location log when adding new file in direct mode. * Deal with stale mappings for deleted file in direct mode. * pre-commit: Update direct mode mappings. + * uninit, unannex --fast: If hard link creation fails, fall back to slow + mode. -- Joey Hess Sat, 26 Jan 2013 15:48:40 +1100 diff --git a/doc/bugs/uninit_does_not_abort_when_hard_link_creation_fails.mdwn b/doc/bugs/uninit_does_not_abort_when_hard_link_creation_fails.mdwn index 9488d6fba..2d98929ab 100644 --- a/doc/bugs/uninit_does_not_abort_when_hard_link_creation_fails.mdwn +++ b/doc/bugs/uninit_does_not_abort_when_hard_link_creation_fails.mdwn @@ -39,3 +39,9 @@ Issue the following commands on a file system where hard links are disabled: git-annex should probably not be used on a file system where hard links are disabled. However, if the user is not aware that he's using git-annex on such a filesystem, he will accidently delete his annexed files by issuing a `git annex uninit` command. + +> git-annex needs a POSIX filesystem, which includes the ability to create +> hard links. The `git annex add` in the example above will fail +> trying to create a hard link with current versions. +> +> I've made uninit fall back to a non-hard link mode. [[done]] --[[Joey]] -- cgit v1.2.3