martin f krafft wrote:
> also sprach Joey Hess <jo...@debian.org> [2014-04-20 19:37 +0200]:
> > AFAIK, git-annex has good reasons to use the permissions it uses for
> > objects directories.
> 
> They seem to be according to umask, not according to
> core.sharedRepository, which is inconsistent if git-annex changes
> the permissions of actual files according to core.sharedRepository,
> and it's inconsistent with core.sharedRepository itself, unless
> that is set to 'umask'.
> 

{- Blocks writing to an annexed file, and modifies file permissions to
 - allow reading it, per core.sharedRepository setting. -}
freezeContent :: FilePath -> Annex ()
freezeContent file = unlessM crippledFileSystem $
        liftIO . go =<< fromRepo getSharedRepository
  where
        go GroupShared = modifyFileMode file $
                removeModes writeModes .
                addModes [ownerReadMode, groupReadMode]
        go AllShared = modifyFileMode file $
                removeModes writeModes .
                addModes readModes
        go _ = modifyFileMode file $
                removeModes writeModes .
                addModes [ownerReadMode]

joey@darkstar:~/tmp>mkdir testcase
joey@darkstar:~/tmp>cd testcase/
joey@darkstar:~/tmp/testcase>git init
Initialized empty Git repository in /home/joey/tmp/testcase/.git/
joey@darkstar:~/tmp/testcase>git config core.sharedRepository group
joey@darkstar:~/tmp/testcase>git annex init
init  ok
(Recording state in git...)
joey@darkstar:~/tmp/testcase>umask 077
joey@darkstar:~/tmp/testcase>date > baz
joey@darkstar:~/tmp/testcase>ls -l baz
-rw------- 1 joey joey 30 Apr 20 15:58 baz
joey@darkstar:~/tmp/testcase>git annex add baz
add baz ok
(Recording state in git...)
joey@darkstar:~/tmp/testcase>ls -la 
.git/annex/objects/87/M7/SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef/
total 12
drwxrwx--- 2 joey joey 4096 Apr 20 15:58 ./
drwxrwx--- 3 joey joey 4096 Apr 20 15:58 ../
-r--r----- 1 joey joey   30 Apr 20 15:58 
SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef

Seems to do the right thing to me.. But your bug report has something
to do about transferring files between repositories.

joey@darkstar:~/tmp/testcase>git commit -m foo
joey@darkstar:~/tmp/testcase>cd ..
joey@darkstar:~/tmp>git clone testcase testcase.2
Cloning into 'testcase.2'...
done.
joey@darkstar:~/tmp>cd testcase.2
joey@darkstar:~/tmp/testcase.2>git config core.sharedRepository group
joey@darkstar:~/tmp/testcase.2>ls
baz@
joey@darkstar:~/tmp/testcase.2>git annex get baz
get baz (merging origin/git-annex into git-annex...)
(Recording state in git...)
(from origin...) ok
(Recording state in git...)
joey@darkstar:~/tmp/testcase.2>ls -la 
.git/annex/objects/87/M7/SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef/
total 12
drwxrwx--- 2 joey joey 4096 Apr 20 16:01 ./
drwxrwx--- 3 joey joey 4096 Apr 20 16:01 ../
-r--r----- 1 joey joey   30 Apr 20 15:58 
SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef

Still seems right, but then again the file is the same mode in the remote.

joey@darkstar:~/tmp/testcase.2>git annex drop --force baz
drop baz ok
(Recording state in git...)
joey@darkstar:~/tmp/testcase.2>chmod 400 
../testcase/.git/annex/objects/87/M7/SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef/SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef
 
joey@darkstar:~/tmp/testcase.2>git annex get baz
get baz (from origin...) ok
(Recording state in git...)
joey@darkstar:~/tmp/testcase.2>ls -la 
.git/annex/objects/87/M7/SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef/
total 12
drwxrwx--- 2 joey joey 4096 Apr 20 16:03 ./
drwxrwx--- 3 joey joey 4096 Apr 20 16:03 ../
-r--r----- 1 joey joey   30 Apr 20 15:58 
SHA256E-s30--6c8935fdc3a173cfffdcb41c34ccc70082053d54db0f2d5b8e7fc4bf8ab59bef

Well, it seemed to add the r bit per core.sharedRepository=group.

I still don't understand what this bug report is about.
-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to