diff options
Diffstat (limited to 'path.c')
-rw-r--r-- | path.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -1,18 +1,24 @@ /* * Utilities for paths and pathnames */ -#include "cache.h" +#include "git-compat-util.h" +#include "abspath.h" +#include "environment.h" +#include "gettext.h" +#include "hex.h" #include "repository.h" #include "strbuf.h" #include "string-list.h" #include "dir.h" #include "worktree.h" +#include "setup.h" #include "submodule-config.h" #include "path.h" #include "packfile.h" #include "object-store.h" #include "lockfile.h" #include "exec-cmd.h" +#include "wrapper.h" static int get_st_mode_bits(const char *path, int *mode) { @@ -347,7 +353,8 @@ static void init_common_trie(void) * Helper function for update_common_dir: returns 1 if the dir * prefix is common. */ -static int check_common(const char *unmatched, void *value, void *baton) +static int check_common(const char *unmatched, void *value, + void *baton UNUSED) { struct common_dir *dir = value; @@ -901,7 +908,13 @@ int adjust_shared_perm(const char *path) if (S_ISDIR(old_mode)) { /* Copy read bits to execute bits */ new_mode |= (new_mode & 0444) >> 2; - new_mode |= FORCE_DIR_SET_GID; + + /* + * g+s matters only if any extra access is granted + * based on group membership. + */ + if (FORCE_DIR_SET_GID && (new_mode & 060)) + new_mode |= FORCE_DIR_SET_GID; } if (((old_mode ^ new_mode) & ~S_IFMT) && |