From 9599d567403f6a0bf185f8a3c4e14a77b69004a5 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 17 Aug 2008 08:58:21 +0200 Subject: [PATCH] Add calls to git_extract_argv0_path() in programs that call git_config_* Programs that use git_config need to find the global configuration. When runtime prefix computation is enabled, this requires that git_extract_argv0_path() is called early in the program's main(). This commit adds the necessary calls in the programs that use git_config. --- daemon.c | 3 +++ fast-import.c | 4 ++++ hash-object.c | 4 ++++ index-pack.c | 4 ++++ unpack-file.c | 4 ++++ var.c | 4 ++++ 6 files changed, 23 insertions(+) diff --git a/daemon.c b/daemon.c index 8dcde73200..172854e74c 100644 --- a/daemon.c +++ b/daemon.c @@ -1055,6 +1055,9 @@ int main(int argc, char **argv) gid_t gid = 0; int i; + if (argv[0] && *argv[0]) + git_extract_argv0_path(argv[0]); + /* Without this we cannot rely on waitpid() to tell * what happened to our children. */ diff --git a/fast-import.c b/fast-import.c index d85b3a561f..239309f96d 100644 --- a/fast-import.c +++ b/fast-import.c @@ -150,6 +150,7 @@ Format of STDIN stream: #include "refs.h" #include "csum-file.h" #include "quote.h" +#include "exec_cmd.h" #define PACK_ID_BITS 16 #define MAX_PACK_ID ((1<"); if (get_sha1(argv[1], sha1)) diff --git a/var.c b/var.c index f1eb314e89..33457dc6ab 100644 --- a/var.c +++ b/var.c @@ -4,6 +4,7 @@ * Copyright (C) Eric Biederman, 2005 */ #include "cache.h" +#include "exec_cmd.h" static const char var_usage[] = "git var [-l | ]"; @@ -56,6 +57,9 @@ int main(int argc, char **argv) usage(var_usage); } + if (argv[0] && *argv[0]) + git_extract_argv0_path(argv[0]); + setup_git_directory_gently(&nongit); val = NULL;