Record the command invocation path early
We will need the command invocation path in system_path(). This path was
passed to setup_path(), but system_path() can be called earlier, for
example via:
main
commit_pager_choice
setup_pager
git_config
git_etc_gitconfig
system_path
Therefore, we introduce git_set_argv0_path() and call it as soon as
possible.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
46beb55988
commit
e1464ca7bb
5
git.c
5
git.c
@ -418,7 +418,6 @@ int main(int argc, const char **argv)
|
||||
{
|
||||
const char *cmd = argv[0] && *argv[0] ? argv[0] : "git-help";
|
||||
char *slash = (char *)cmd + strlen(cmd);
|
||||
const char *cmd_path = NULL;
|
||||
int done_alias = 0;
|
||||
|
||||
/*
|
||||
@ -431,7 +430,7 @@ int main(int argc, const char **argv)
|
||||
while (cmd <= slash && !is_dir_sep(*slash));
|
||||
if (cmd <= slash) {
|
||||
*slash++ = 0;
|
||||
cmd_path = cmd;
|
||||
git_set_argv0_path(cmd);
|
||||
cmd = slash;
|
||||
}
|
||||
|
||||
@ -475,7 +474,7 @@ int main(int argc, const char **argv)
|
||||
* environment, and the $(gitexecdir) from the Makefile at build
|
||||
* time.
|
||||
*/
|
||||
setup_path(cmd_path);
|
||||
setup_path();
|
||||
|
||||
while (1) {
|
||||
/* See if it's an internal command */
|
||||
|
||||
Reference in New Issue
Block a user