wrap shared_repository global in get/set accessors
It would be useful to control access to the global shared_repository, so that we can lazily load its config. The first step to doing so is to make sure all access goes through a set of functions. This step is purely mechanical, and should result in no change of behavior. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4b0d1eebe9
commit
7875acb6ec
10
path.c
10
path.c
@ -699,17 +699,17 @@ static int calc_shared_perm(int mode)
|
||||
{
|
||||
int tweak;
|
||||
|
||||
if (shared_repository < 0)
|
||||
tweak = -shared_repository;
|
||||
if (get_shared_repository() < 0)
|
||||
tweak = -get_shared_repository();
|
||||
else
|
||||
tweak = shared_repository;
|
||||
tweak = get_shared_repository();
|
||||
|
||||
if (!(mode & S_IWUSR))
|
||||
tweak &= ~0222;
|
||||
if (mode & S_IXUSR)
|
||||
/* Copy read bits to execute bits */
|
||||
tweak |= (tweak & 0444) >> 2;
|
||||
if (shared_repository < 0)
|
||||
if (get_shared_repository() < 0)
|
||||
mode = (mode & ~0777) | tweak;
|
||||
else
|
||||
mode |= tweak;
|
||||
@ -722,7 +722,7 @@ int adjust_shared_perm(const char *path)
|
||||
{
|
||||
int old_mode, new_mode;
|
||||
|
||||
if (!shared_repository)
|
||||
if (!get_shared_repository())
|
||||
return 0;
|
||||
if (get_st_mode_bits(path, &old_mode) < 0)
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user