Skip to content

Commit 5690910

Browse files
committed
Merge branch 'kj/path-micro-code-cleanup' into next
Code clean-up. * kj/path-micro-code-cleanup: path: remove redundant function calls path: use size_t for dir_prefix length path: remove unused header
2 parents 99dc92c + b22ed4c commit 5690910

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

path.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include "git-compat-util.h"
66
#include "abspath.h"
7-
#include "environment.h"
87
#include "gettext.h"
98
#include "repository.h"
109
#include "strbuf.h"
@@ -59,7 +58,7 @@ static void strbuf_cleanup_path(struct strbuf *sb)
5958

6059
static int dir_prefix(const char *buf, const char *dir)
6160
{
62-
int len = strlen(dir);
61+
size_t len = strlen(dir);
6362
return !strncmp(buf, dir, len) &&
6463
(is_dir_sep(buf[len]) || buf[len] == '\0');
6564
}
@@ -741,18 +740,18 @@ int calc_shared_perm(struct repository *repo,
741740
int mode)
742741
{
743742
int tweak;
744-
745-
if (repo_settings_get_shared_repository(repo) < 0)
746-
tweak = -repo_settings_get_shared_repository(repo);
743+
int shared_repo = repo_settings_get_shared_repository(repo);
744+
if (shared_repo < 0)
745+
tweak = -shared_repo;
747746
else
748-
tweak = repo_settings_get_shared_repository(repo);
747+
tweak = shared_repo;
749748

750749
if (!(mode & S_IWUSR))
751750
tweak &= ~0222;
752751
if (mode & S_IXUSR)
753752
/* Copy read bits to execute bits */
754753
tweak |= (tweak & 0444) >> 2;
755-
if (repo_settings_get_shared_repository(repo) < 0)
754+
if (shared_repo < 0)
756755
mode = (mode & ~0777) | tweak;
757756
else
758757
mode |= tweak;

0 commit comments

Comments
 (0)