summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-03-11 22:36:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-11 23:02:17 (GMT)
commit7875acb6ecf85a7dc29554d193955ce5e265764f (patch)
tree58b24619636ee321eaea313575b92e83dc636f0e /path.c
parent4b0d1eebe95b8ed187ff06ae46d69d517c2b759f (diff)
downloadgit-7875acb6ecf85a7dc29554d193955ce5e265764f.zip
git-7875acb6ecf85a7dc29554d193955ce5e265764f.tar.gz
git-7875acb6ecf85a7dc29554d193955ce5e265764f.tar.bz2
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>
Diffstat (limited to 'path.c')
-rw-r--r--path.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/path.c b/path.c
index 8b7e168..a6f1cd6 100644
--- a/path.c
+++ b/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;