summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/ReplaceFile.hs8
-rw-r--r--debian/changelog1
2 files changed, 6 insertions, 3 deletions
diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs
index 8776762e9..8cb0cc6da 100644
--- a/Annex/ReplaceFile.hs
+++ b/Annex/ReplaceFile.hs
@@ -30,14 +30,16 @@ replaceFileOr :: FilePath -> (FilePath -> Annex ()) -> (FilePath -> Annex ()) ->
replaceFileOr file action rollback = do
tmpdir <- fromRepo gitAnnexTmpMiscDir
void $ createAnnexDirectory tmpdir
- bracket (liftIO $ setup tmpdir) rollback $ \tmpfile -> do
- action tmpfile
- liftIO $ catchIO (rename tmpfile file) (fallback tmpfile)
+ tmpfile <- liftIO $ setup tmpdir
+ go tmpfile `catchNonAsync` (const $ rollback tmpfile)
where
setup tmpdir = do
(tmpfile, h) <- openTempFileWithDefaultPermissions tmpdir "tmp"
hClose h
return tmpfile
+ go tmpfile = do
+ action tmpfile
+ liftIO $ catchIO (rename tmpfile file) (fallback tmpfile)
fallback tmpfile _ = do
createDirectoryIfMissing True $ parentDir file
moveFile tmpfile file
diff --git a/debian/changelog b/debian/changelog
index e83a7f518..48b6296d7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,7 @@ git-annex (5.20140718) UNRELEASED; urgency=medium
* Windows: Now uses actual inode equivilants in new direct mode
repositories, for safer detection of eg, renaming of files with the same
size and mtime.
+ * direct: Fix ugly warning messages.
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2014 14:41:26 -0400