Skip to content

Commit 7931d54

Browse files
committed
fixup! Windows: add support for a Windows-wide configuration
Let's avoid the triple function call; We can just store the result and use it three times instead. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 69e7a4c commit 7931d54

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

config.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,14 +1675,13 @@ static int do_git_config_sequence(const struct config_options *opts,
16751675

16761676
current_parsing_scope = CONFIG_SCOPE_SYSTEM;
16771677
if (git_config_system()) {
1678-
if (git_program_data_config() &&
1679-
!access_or_die(git_program_data_config(), R_OK, 0))
1680-
ret += git_config_from_file(fn,
1681-
git_program_data_config(),
1682-
data);
1683-
if (!access_or_die(git_etc_gitconfig(), R_OK, 0))
1684-
ret += git_config_from_file(fn, git_etc_gitconfig(),
1685-
data);
1678+
const char *program_data = git_program_data_config();
1679+
const char *etc = git_etc_gitconfig();
1680+
1681+
if (program_data && !access_or_die(program_data, R_OK, 0))
1682+
ret += git_config_from_file(fn, program_data, data);
1683+
if (!access_or_die(etc, R_OK, 0))
1684+
ret += git_config_from_file(fn, etc, data);
16861685
}
16871686

16881687
current_parsing_scope = CONFIG_SCOPE_GLOBAL;

0 commit comments

Comments
 (0)