diff options
author | Joey Hess <joeyh@joeyh.name> | 2018-01-02 17:17:10 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2018-01-02 17:25:25 -0400 |
commit | ed2c1839fd8e0616165de569cff939dc3bf6527d (patch) | |
tree | 7dd4eed72c8a32ccd53f8bb75620e205eba514a5 /Logs/File.hs | |
parent | 2c16edc58f1f549cd4e5611c0f7c45fec6b66da0 (diff) |
Fix several places where files in .git/annex/ were written with modes that did not take the core.sharedRepository config into account.
git grep writeFile finds some more that might also be problems, but
for now I've concentrated on .git/annex/ log files. There are certianly
cases where writeFile is not a problem too.
This commit was sponsored by mo on Patreon.
Diffstat (limited to 'Logs/File.hs')
-rw-r--r-- | Logs/File.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Logs/File.hs b/Logs/File.hs new file mode 100644 index 000000000..c93b21e4d --- /dev/null +++ b/Logs/File.hs @@ -0,0 +1,24 @@ +{- git-annex log files + - + - Copyright 2018 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Logs.File where + +import Annex.Common +import Annex.Perms +import Utility.Tmp + +writeLogFile :: FilePath -> String -> Annex () +writeLogFile f c = go `catchNonAsync` \_e -> do + -- Most of the time, the directory will exist, so this is only + -- done if writing the file fails. + createAnnexDirectory (parentDir f) + go + where + go = viaTmp writelog f c + writelog f' c' = do + liftIO $ writeFile f' c' + setAnnexFilePerm f' |