@matheusbsbs / matheus-bagliano / commits / 43db492a8e
Fork 0

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>

Johannes Schindelin committed Oct 20, 2007 at 08:21 UTC 43db492a8eb701dd157f88ae9ca38d366c280761
1 file changed +3 -2
git.c
+3 -2
@@ -409,13 +409,14 @@ int main(int argc, const char **argv)
409 /*
410 * Take the basename of argv[0] as the command
411 * name, and the dirname as the default exec_path
412 - * if it's an absolute path and we don't have
413 - * anything better.
412 + * if we don't have anything better.
413 */
414 if (slash) {
415 *slash++ = 0;
416 if (*cmd == '/')
417 exec_path = cmd;
418 + else
419 + exec_path = xstrdup(make_absolute_path(cmd));
420 cmd = slash;
421 }
422