summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-05 14:09:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-05 14:09:57 -0400
commit1187ce4341f22cb8a8a1ce4c758652e50fe66c55 (patch)
tree982c7e28edbd38e39c2f952d424aff20d9e572a3
parente7fce9f30007dda543f5581371cf624e8a23cb99 (diff)
add: Fix rollback when disk is completely full.
Noticed that it was possible for add to move a file to .git/annex/objects and not make the link if the disk was full. This happened because the location log update failed, and so addLink never got a chance to run. Running addLink first fixes it; on error it will unwind by moving the file back to where it was originally.
-rw-r--r--Command/Add.hs4
-rw-r--r--debian/changelog1
2 files changed, 3 insertions, 2 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 9f1beb28a..c5035ba1f 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -250,12 +250,12 @@ addLink file key mcache = ifM (coreSymlinks <$> Annex.getGitConfig)
cleanup :: FilePath -> Key -> Maybe InodeCache -> Bool -> CommandCleanup
cleanup file key mcache hascontent = do
- when hascontent $
- logStatus key InfoPresent
ifM (isDirect <&&> pure hascontent)
( do
l <- inRepo $ gitAnnexLink file key
stageSymlink file =<< hashSymlink l
, addLink file key mcache
)
+ when hascontent $
+ logStatus key InfoPresent
return True
diff --git a/debian/changelog b/debian/changelog
index 28a11900b..0a2a45df4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,7 @@ git-annex (5.20131231) UNRELEASED; urgency=medium
ssh refuse to use them, if it allows another user to write to them.
* addurl, importfeed: Honor annex.diskreserve as long as the size of the
url can be checked.
+ * add: Fix rollback when disk is completely full.
-- Joey Hess <joeyh@debian.org> Tue, 31 Dec 2013 13:41:18 -0400