Skip to content

Commit abc9ea6

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 202835b commit abc9ea6

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
@@ -1678,14 +1678,13 @@ static int do_git_config_sequence(const struct config_options *opts,
16781678
current_parsing_scope = CONFIG_SCOPE_SYSTEM;
16791679
if (git_config_system()) {
16801680
int flags = opts->system_gently ? ACCESS_EACCES_OK : 0;
1681-
if (git_program_data_config() &&
1682-
!access_or_die(git_program_data_config(), R_OK, flags))
1683-
ret += git_config_from_file(fn,
1684-
git_program_data_config(),
1685-
data);
1686-
if (!access_or_die(git_etc_gitconfig(), R_OK, flags))
1687-
ret += git_config_from_file(fn, git_etc_gitconfig(),
1688-
data);
1681+
const char *program_data = git_program_data_config();
1682+
const char *etc = git_etc_gitconfig();
1683+
1684+
if (program_data && !access_or_die(program_data, R_OK, flags))
1685+
ret += git_config_from_file(fn, program_data, data);
1686+
if (!access_or_die(etc, R_OK, flags))
1687+
ret += git_config_from_file(fn, etc, data);
16891688
}
16901689

16911690
current_parsing_scope = CONFIG_SCOPE_GLOBAL;

0 commit comments

Comments
 (0)