more core.sharedRepository perm fixes
Fix more places where files in .git/annex/ were written with modes that did not take the core.sharedRepository config into account. This commit was sponsored by Jeff Goeke-Smith on Patreon.
This commit is contained in:
parent
1825012e60
commit
faf03ee4da
3 changed files with 9 additions and 5 deletions
|
@ -57,6 +57,7 @@ import Annex.CatFile
|
||||||
import Annex.Perms
|
import Annex.Perms
|
||||||
import Logs
|
import Logs
|
||||||
import Logs.Transitions
|
import Logs.Transitions
|
||||||
|
import Logs.File
|
||||||
import Logs.Trust.Pure
|
import Logs.Trust.Pure
|
||||||
import Logs.Difference.Pure
|
import Logs.Difference.Pure
|
||||||
import Annex.ReplaceFile
|
import Annex.ReplaceFile
|
||||||
|
@ -420,8 +421,7 @@ needUpdateIndex branchref = do
|
||||||
setIndexSha :: Git.Ref -> Annex ()
|
setIndexSha :: Git.Ref -> Annex ()
|
||||||
setIndexSha ref = do
|
setIndexSha ref = do
|
||||||
f <- fromRepo gitAnnexIndexStatus
|
f <- fromRepo gitAnnexIndexStatus
|
||||||
liftIO $ writeFile f $ fromRef ref ++ "\n"
|
writeLogFile f $ fromRef ref ++ "\n"
|
||||||
setAnnexFilePerm f
|
|
||||||
runAnnexHook postUpdateAnnexHook
|
runAnnexHook postUpdateAnnexHook
|
||||||
|
|
||||||
{- Stages the journal into the index and returns an action that will
|
{- Stages the journal into the index and returns an action that will
|
||||||
|
@ -583,7 +583,7 @@ ignoreRefs rs = do
|
||||||
old <- getIgnoredRefs
|
old <- getIgnoredRefs
|
||||||
let s = S.unions [old, S.fromList rs]
|
let s = S.unions [old, S.fromList rs]
|
||||||
f <- fromRepo gitAnnexIgnoredRefs
|
f <- fromRepo gitAnnexIgnoredRefs
|
||||||
replaceFile f $ \tmp -> liftIO $ writeFile tmp $
|
writeLogFile f $
|
||||||
unlines $ map fromRef $ S.elems s
|
unlines $ map fromRef $ S.elems s
|
||||||
|
|
||||||
getIgnoredRefs :: Annex (S.Set Git.Sha)
|
getIgnoredRefs :: Annex (S.Set Git.Sha)
|
||||||
|
@ -600,7 +600,7 @@ addMergedRefs new = do
|
||||||
-- Keep only the newest sha for each branch.
|
-- Keep only the newest sha for each branch.
|
||||||
let l = nubBy ((==) `on` snd) (new ++ old)
|
let l = nubBy ((==) `on` snd) (new ++ old)
|
||||||
f <- fromRepo gitAnnexMergedRefs
|
f <- fromRepo gitAnnexMergedRefs
|
||||||
replaceFile f $ \tmp -> liftIO $ writeFile tmp $
|
writeLogFile f $
|
||||||
unlines $ map (\(s, b) -> fromRef s ++ '\t' : fromRef b) l
|
unlines $ map (\(s, b) -> fromRef s ++ '\t' : fromRef b) l
|
||||||
|
|
||||||
getMergedRefs :: Annex (S.Set Git.Sha)
|
getMergedRefs :: Annex (S.Set Git.Sha)
|
||||||
|
|
|
@ -34,6 +34,7 @@ import Annex.Perms
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import Utility.Tmp
|
import Utility.Tmp
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
|
import Logs.File
|
||||||
import Utility.InodeCache
|
import Utility.InodeCache
|
||||||
import Utility.CopyFile
|
import Utility.CopyFile
|
||||||
import Annex.ReplaceFile
|
import Annex.ReplaceFile
|
||||||
|
@ -67,7 +68,7 @@ changeAssociatedFiles key transform = do
|
||||||
let files' = transform files
|
let files' = transform files
|
||||||
when (files /= files') $
|
when (files /= files') $
|
||||||
modifyContent mapping $
|
modifyContent mapping $
|
||||||
liftIO $ viaTmp writeFile mapping $ unlines files'
|
writeLogFile mapping $ unlines files'
|
||||||
top <- fromRepo Git.repoPath
|
top <- fromRepo Git.repoPath
|
||||||
return $ map (top </>) files'
|
return $ map (top </>) files'
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ import Annex.Common
|
||||||
import Annex.Perms
|
import Annex.Perms
|
||||||
import Utility.Tmp
|
import Utility.Tmp
|
||||||
|
|
||||||
|
-- | Writes content to a file, replacing the file atomically, and
|
||||||
|
-- making the new file have whatever permissions the git repository is
|
||||||
|
-- configured to use. Creates the parent directory when necessary.
|
||||||
writeLogFile :: FilePath -> String -> Annex ()
|
writeLogFile :: FilePath -> String -> Annex ()
|
||||||
writeLogFile f c = go `catchNonAsync` \_e -> do
|
writeLogFile f c = go `catchNonAsync` \_e -> do
|
||||||
-- Most of the time, the directory will exist, so this is only
|
-- Most of the time, the directory will exist, so this is only
|
||||||
|
|
Loading…
Reference in a new issue