From: Johannes Schindelin Date: Sat, 20 Oct 2007 07:21:34 +0000 (+0100) Subject: Deduce exec_path also from calls to git with a relative path X-Git-Tag: v1.5.4-rc0~334 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=43db492a8eb701dd157f88ae9ca38d366c280761;p=git.git 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 Signed-off-by: Shawn O. Pearce --- diff --git a/git.c b/git.c index 9eaca1d67..853e66cdd 100644 --- a/git.c +++ b/git.c @@ -409,13 +409,14 @@ int main(int argc, const char **argv) /* * Take the basename of argv[0] as the command * name, and the dirname as the default exec_path - * if it's an absolute path and we don't have - * anything better. + * if we don't have anything better. */ if (slash) { *slash++ = 0; if (*cmd == '/') exec_path = cmd; + else + exec_path = xstrdup(make_absolute_path(cmd)); cmd = slash; }