Commit Graph

4 Commits

Author SHA1 Message Date
Elliott Sales de Andrade
48982cc02e TST: Trim security context when checking permissions.
This fixes the umask tests on a file system that uses security context,
as that prints out an extra dot in the permissions.
2019-01-15 01:20:13 -05:00
brian m. carlson
cc815f59e6
Use proper repo permissions when creating directories
Honor the repository permssions set with the umask or
core.sharedRepository when creating directories by using tools.MkdirAll.
Pass an appropriate configuration or filesystem object through as needed
to ensure that we can query the proper permissions. Add a test that
these code paths work by cloning a new repository and then performing
some operations on it.

Note that in the test, we match patterns with either the setgid bit
clear or set, since it may be set or not depending on whether the system
has SysV or BSD group semantics.
2018-12-13 17:51:02 +00:00
brian m. carlson
de1954d638
lfs: honor core.sharedRepository
In order to manage a shared repository easily among multiple users, Git
has the core.sharedRepository variable, which is used to set permissions
for writing objects and files in the repository.  Teach Git LFS to
handle this as well by teaching the existing temporary file code to
honor this setting over the umask.  Since this logic is complex, add
unit and integration tests to ensure that all the code paths are
covered.
2018-10-09 15:11:18 +00:00
brian m. carlson
286c64c34b
lfs: honor umask when writing LFS file storage
When writing files to the LFS file storage, we create a temporary file
and rename it into its correct place.  Use the function that was
recently introduced to create a temporary file that honors the umask.
This should make all uses of Git LFS honor the umask, since Git handles
writing the working tree files for us.

We compute the proper permissions value on demand.  In a future commit,
we'll need to read the configuration file, and on clone, we'll want to
wait to read the configuration until we have a repository.

Add a test for this and skip it on Windows, since we cannot be
guaranteed to have POSIX permission support there.
2018-10-09 15:11:17 +00:00