summaryrefslogtreecommitdiff
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
parentf4ced8dd9f70fe46e4c8c34acb58e28aff009907 (diff)
uninit, unannex --fast: If hard link creation fails, fall back to slow mode.
-rw-r--r--Command/Unannex.hs22
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/uninit_does_not_abort_when_hard_link_creation_fails.mdwn6
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 <joeyh@debian.org> 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]]