Skip to content

Commit

Permalink
Deduce exec_path also from calls to git with a relative path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Shawn O. Pearce committed Oct 21, 2007
1 parent d9a5f25 commit 43db492
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 43db492

Please sign in to comment.