uninit, unannex --fast: If hard link creation fails, fall back to slow mode.

This commit is contained in:
Joey Hess 2013-02-06 14:02:18 -04:00
parent a9dbd9993e
commit b1de99c1d4
3 changed files with 22 additions and 8 deletions

View file

@ -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

2
debian/changelog vendored
View file

@ -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

View file

@ -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]]