Commit 3a429d3b authored by Torsten Bögershausen's avatar Torsten Bögershausen Committed by Junio C Hamano

path.c: simplify adjust_shared_perm()

All calls to set_shared_perm() use mode == 0, so simplify the

Because all callers use the macro adjust_shared_perm(path) from
cache.h to call this function, convert it to a proper function,
losing set_shared_perm().

Since path.c has much more functions than just mkpath() these days,
drop the stale comment about it.
Signed-off-by: default avatarTorsten Bögershausen <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 0117c2f0
......@@ -713,8 +713,7 @@ enum sharedrepo {
int git_config_perm(const char *var, const char *value);
int set_shared_perm(const char *path, int mode);
#define adjust_shared_perm(path) set_shared_perm((path), 0)
int adjust_shared_perm(const char *path);
int safe_create_leading_directories(char *path);
int safe_create_leading_directories_const(const char *path);
int mkdir_in_gitdir(const char *path);
* I'm tired of doing "vsnprintf()" etc just to open a
* file, so here's a "return static buffer with printf"
* interface for paths.
* It's obviously not thread-safe. Sue me. But it's quite
* useful for doing things like
* f = open(mkpath("%s/%s.git", base, name), O_RDONLY);
* which is what it's designed for.
* Utilities for paths and pathnames
#include "cache.h"
#include "strbuf.h"
......@@ -405,21 +396,17 @@ const char *enter_repo(const char *path, int strict)
return NULL;
int set_shared_perm(const char *path, int mode)
int adjust_shared_perm(const char *path)
int tweak, shared, orig_mode;
int tweak, shared, orig_mode, mode;
if (!shared_repository) {
if (mode)
return chmod(path, mode & ~S_IFMT);
return 0;
if (!mode) {
if (get_st_mode_bits(path, &mode) < 0)
return -1;
orig_mode = mode;
} else
orig_mode = 0;
if (get_st_mode_bits(path, &mode) < 0)
return -1;
orig_mode = mode;
if (shared_repository < 0)
shared = -shared_repository;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment