Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.

If the user specified the full path to git-upload-pack as the -u option to
"git clone" when cloning a remote repository, and git was not on the default
PATH on the remote machine, git-upload-pack was failing to exec
git-pack-objects.

By making the argv[0] path (if any) available to setup_path(), this will
allow finding the "git" executable in the same directory as
"git-upload-pack". The default built in to exec_cmd.c is to look for "git"
in the ".../libexec/git-core" directory, but it is not installed there (any
longer).

Much the same applies to invoking git-receive-pack from a non-PATH location
using the "--exec" argument to "git push".

[ spr: split Steve's original commit into two commits. ]

Signed-off-by: Steve Haslam <shaslam@lastminute.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This commit is contained in:
Steve Haslam
2008-07-30 12:27:18 +01:00
committed by Steffen Prohaska
parent f2fdec9deb
commit 2a7e0eeb48
2 changed files with 6 additions and 0 deletions

View File

@@ -467,6 +467,9 @@ int main(int argc, char **argv)
int i;
char *dir = NULL;
if (argv[0] && *argv[0])
git_extract_argv0_path(argv[0]);
argv++;
for (i = 1; i < argc; i++) {
char *arg = *argv++;

View File

@@ -616,6 +616,9 @@ int main(int argc, char **argv)
int i;
int strict = 0;
if (argv[0] && *argv[0])
git_extract_argv0_path(argv[0]);
for (i = 1; i < argc; i++) {
char *arg = argv[i];