From 11c97d173423bd5d3320124670ccc3b4c8675c06 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 May 2015 14:53:19 -0400 Subject: honor core.sharedRepository settings in lockContent The content file may not be owned by the user running git-annex, in which case, setting the owner write bit was not enough to let lockContent act on the file. However, with some core.sharedRepository configs, the file should be writable by the user's group. So, the thing to do is to call thawContent on it. --- Annex/Content.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Annex') diff --git a/Annex/Content.hs b/Annex/Content.hs index c23d7e951..379ff0785 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -182,11 +182,11 @@ lockContent key a = do #ifndef mingw32_HOST_OS {- Since content files are stored with the write bit disabled, have - to fiddle with permissions to open for an exclusive lock. -} - lock contentfile Nothing = trylock $ liftIO $ - withModifiedFileMode contentfile - (`unionFileModes` ownerWriteMode) $ - maybe alreadylocked return - =<< tryLockExclusive Nothing contentfile + lock contentfile Nothing = trylock $ bracket_ + (thawContent contentfile) + (freezeContent contentfile) + (maybe alreadylocked return + =<< liftIO (tryLockExclusive Nothing contentfile)) lock _ (Just lockfile) = trylock $ do mode <- annexFileMode maybe alreadylocked return -- cgit v1.2.3