path: root/path.c
diff options
authorPetr Baudis <>2008-07-12 01:15:03 (GMT)
committerJunio C Hamano <>2008-07-12 03:38:30 (GMT)
commit8c6202d8696d2e3ae016042acd05f6a82763a5e3 (patch)
tree288e4fdc02a408ba909028b8203b5872af352f1f /path.c
parente09c4e753c337d914f4eb7a05cb5e8bbfc362489 (diff)
Fix backwards-incompatible handling of core.sharedRepository
06cbe85 (Make core.sharedRepository more generic, 2008-04-16) broke the traditional setting of core.sharedRepository to true, which was to make the repository group writable: with umask 022, it would clear the permission bits for 'other'. (umask 002 did not exhibit this behaviour since pre-chmod() check in adjust_shared_perm() fails in that case.) The call to adjust_shared_perm() should only loosen the permission. If the user has umask like 022 or 002 that allow others to read, the resulting files should be made readable and writable by group, without restricting the readability by others. This patch fixes the adjust_shared_perm() mode tweak based on Junio's suggestion and adds the appropriate tests to t/ Cc: Heikki Orsila <> Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'path.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/path.c b/path.c
index 6e3df18..c1d5679 100644
--- a/path.c
+++ b/path.c
@@ -272,7 +272,7 @@ int adjust_shared_perm(const char *path)
int tweak = shared_repository;
if (!(mode & S_IWUSR))
tweak &= ~0222;
- mode = (mode & ~0777) | tweak;
+ mode |= tweak;
} else {
/* Preserve old PERM_UMASK behaviour */
if (mode & S_IWUSR)