Deduce exec_path also from calls to git with a relative path
There is already logic in the git wrapper to deduce the exec_path from argv[0], when the git wrapper was called with an absolute path. Extend that logic to handle relative paths as well. For example, when you call "../../hello/world/git", it will not turn "../../hello/world" into an absolute path, and use that. Initial implementation by Scott R Parish. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
d9a5f25b67
commit
43db492a8e
5
git.c
5
git.c
@ -409,13 +409,14 @@ int main(int argc, const char **argv)
|
|||||||
/*
|
/*
|
||||||
* Take the basename of argv[0] as the command
|
* Take the basename of argv[0] as the command
|
||||||
* name, and the dirname as the default exec_path
|
* name, and the dirname as the default exec_path
|
||||||
* if it's an absolute path and we don't have
|
* if we don't have anything better.
|
||||||
* anything better.
|
|
||||||
*/
|
*/
|
||||||
if (slash) {
|
if (slash) {
|
||||||
*slash++ = 0;
|
*slash++ = 0;
|
||||||
if (*cmd == '/')
|
if (*cmd == '/')
|
||||||
exec_path = cmd;
|
exec_path = cmd;
|
||||||
|
else
|
||||||
|
exec_path = xstrdup(make_absolute_path(cmd));
|
||||||
cmd = slash;
|
cmd = slash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user