MCPcopy Index your code
hub / github.com/git/git / adjust_shared_perm

Function adjust_shared_perm

path.c:762–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760}
761
762int adjust_shared_perm(struct repository *repo,
763 const char *path)
764{
765 int old_mode, new_mode;
766
767 if (!repo_settings_get_shared_repository(repo))
768 return 0;
769 if (get_st_mode_bits(path, &old_mode) < 0)
770 return -1;
771
772 new_mode = calc_shared_perm(repo, old_mode);
773 if (S_ISDIR(old_mode)) {
774 /* Copy read bits to execute bits */
775 new_mode |= (new_mode & 0444) >> 2;
776
777 /*
778 * g+s matters only if any extra access is granted
779 * based on group membership.
780 */
781 if (FORCE_DIR_SET_GID && (new_mode & 060))
782 new_mode |= FORCE_DIR_SET_GID;
783 }
784
785 if (((old_mode ^ new_mode) & ~S_IFMT) &&
786 chmod(path, (new_mode & ~S_IFMT)) < 0)
787 return -2;
788 return 0;
789}
790
791void safe_create_dir(struct repository *repo, const char *dir, int share)
792{

Callers 15

create_default_filesFunction · 0.85
safe_create_dirFunction · 0.85
write_one_objectFunction · 0.85
create_tmpfileFunction · 0.85
create_tempfile_modeFunction · 0.85
write_commit_graph_fileFunction · 0.85
copy_fileFunction · 0.85
migrate_oneFunction · 0.85
write_midx_internalFunction · 0.85

Calls 3

get_st_mode_bitsFunction · 0.85
calc_shared_permFunction · 0.85

Tested by

no test coverage detected