diff options
-rw-r--r-- | Remote/Directory.hs | 4 | ||||
-rw-r--r-- | debian/changelog | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 8ca2a2875..23265dabc 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -98,11 +98,13 @@ storeEncrypted d (cipher, enck) k = do storeHelper :: FilePath -> Key -> (FilePath -> IO Bool) -> IO Bool storeHelper d key a = do let dest = Prelude.head $ locations d key + let tmpdest = dest ++ ".tmp" let dir = parentDir dest createDirectoryIfMissing True dir allowWrite dir - ok <- a dest + ok <- a tmpdest when ok $ do + renameFile tmpdest dest preventWrite dest preventWrite dir return ok diff --git a/debian/changelog b/debian/changelog index 17816dc1a..61922ae05 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +git-annex (3.20120116) UNRELEASED; urgency=low + + * Fix data loss bug in directory special remote, when moving a file + to the remote failed, and partially transferred content was left + behind in the directory, re-running the same move would think it + succeeded and delete the local copy. + + -- Joey Hess <joeyh@debian.org> Mon, 16 Jan 2012 16:21:51 -0400 + git-annex (3.20120115) unstable; urgency=low * Add a sanity check for bad StatFS results. On architectures |