Skip to content

Commit 4ec22a4

Browse files
author
Johannes Sixt
committed
Turn builtin_exec_path into a function.
builtin_exec_path returns the hard-coded installation path, which is used as the ultimate fallback to look for git commands. Making it into a function enables us in a follow-up patch to return a computed value instead of just a constant string. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
1 parent fc2ded5 commit 4ec22a4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

exec_cmd.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
#define MAX_ARGS 32
55

66
extern char **environ;
7-
static const char *builtin_exec_path = GIT_EXEC_PATH;
87
static const char *argv_exec_path;
98

9+
static const char *builtin_exec_path(void)
10+
{
11+
return GIT_EXEC_PATH;
12+
}
13+
1014
void git_set_argv_exec_path(const char *exec_path)
1115
{
1216
argv_exec_path = exec_path;
@@ -26,7 +30,7 @@ const char *git_exec_path(void)
2630
return env;
2731
}
2832

29-
return builtin_exec_path;
33+
return builtin_exec_path();
3034
}
3135

3236
static void add_path(struct strbuf *out, const char *path)
@@ -50,7 +54,7 @@ void setup_path(const char *cmd_path)
5054

5155
add_path(&new_path, argv_exec_path);
5256
add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
53-
add_path(&new_path, builtin_exec_path);
57+
add_path(&new_path, builtin_exec_path());
5458
add_path(&new_path, cmd_path);
5559

5660
if (old_path)

0 commit comments

Comments
 (0)