From: Steffen Prohaska Date: Sun, 18 Jan 2009 12:00:12 +0000 (+0100) Subject: Add calls to git_extract_argv0_path() in programs that call git_config_* X-Git-Tag: v1.6.2-rc0~48^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2fb3f6db96492b680899f9e40f434eeb4c778a84;p=git.git 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. Signed-off-by: Steffen Prohaska Acked-by: Johannes Sixt Signed-off-by: Junio C Hamano --- diff --git a/daemon.c b/daemon.c index 540700ee8..d93cf960f 100644 --- a/daemon.c +++ b/daemon.c @@ -937,6 +937,8 @@ int main(int argc, char **argv) gid_t gid = 0; int i; + git_extract_argv0_path(argv[0]); + for (i = 1; i < argc; i++) { char *arg = argv[i]; diff --git a/fast-import.c b/fast-import.c index f0e08aca7..1935206be 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< (-a | [--] *)"); + git_extract_argv0_path(argv[0]); + setup_git_directory(); read_cache(); diff --git a/merge-tree.c b/merge-tree.c index 2d1413efb..f18201acd 100644 --- a/merge-tree.c +++ b/merge-tree.c @@ -2,6 +2,7 @@ #include "tree-walk.h" #include "xdiff-interface.h" #include "blob.h" +#include "exec_cmd.h" static const char merge_tree_usage[] = "git-merge-tree "; static int resolve_directories = 1; @@ -344,6 +345,8 @@ int main(int argc, char **argv) if (argc != 4) usage(merge_tree_usage); + git_extract_argv0_path(argv[0]); + setup_git_directory(); buf1 = get_tree_descriptor(t+0, argv[1]); diff --git a/mktag.c b/mktag.c index ba3d495e0..6d5083eaf 100644 --- a/mktag.c +++ b/mktag.c @@ -1,5 +1,6 @@ #include "cache.h" #include "tag.h" +#include "exec_cmd.h" /* * A signature file has a very simple fixed format: four lines @@ -159,6 +160,8 @@ int main(int argc, char **argv) if (argc != 1) usage("git-mktag < signaturefile"); + git_extract_argv0_path(argv[0]); + setup_git_directory(); if (strbuf_read(&buf, 0, 4096) < 0) { diff --git a/mktree.c b/mktree.c index 514fd9b15..6283bc3d4 100644 --- a/mktree.c +++ b/mktree.c @@ -6,6 +6,7 @@ #include "cache.h" #include "quote.h" #include "tree.h" +#include "exec_cmd.h" static struct treeent { unsigned mode; @@ -70,6 +71,8 @@ int main(int ac, char **av) unsigned char sha1[20]; int line_termination = '\n'; + git_extract_argv0_path(av[0]); + setup_git_directory(); while ((1 < ac) && av[1][0] == '-') { diff --git a/pack-redundant.c b/pack-redundant.c index e93eb966e..48a12bc13 100644 --- a/pack-redundant.c +++ b/pack-redundant.c @@ -7,6 +7,7 @@ */ #include "cache.h" +#include "exec_cmd.h" #define BLKSIZE 512 @@ -601,6 +602,8 @@ int main(int argc, char **argv) unsigned char *sha1; char buf[42]; /* 40 byte sha1 + \n + \0 */ + git_extract_argv0_path(argv[0]); + setup_git_directory(); for (i = 1; i < argc; i++) { diff --git a/patch-id.c b/patch-id.c index 871f1d20c..3660ad461 100644 --- a/patch-id.c +++ b/patch-id.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "exec_cmd.h" static void flush_current_id(int patchlen, unsigned char *id, git_SHA_CTX *c) { @@ -79,6 +80,8 @@ int main(int argc, char **argv) if (argc != 1) usage(patch_id_usage); + git_extract_argv0_path(argv[0]); + generate_id_list(); return 0; } diff --git a/unpack-file.c b/unpack-file.c index bcdc8bbb3..6dd8ad02f 100644 --- a/unpack-file.c +++ b/unpack-file.c @@ -1,5 +1,6 @@ #include "cache.h" #include "blob.h" +#include "exec_cmd.h" static char *create_temp_file(unsigned char *sha1) { @@ -25,6 +26,8 @@ int main(int argc, char **argv) { unsigned char sha1[20]; + git_extract_argv0_path(argv[0]); + if (argc != 2) usage("git-unpack-file "); if (get_sha1(argv[1], sha1)) diff --git a/update-server-info.c b/update-server-info.c index 7e8209ea4..7b38fd867 100644 --- a/update-server-info.c +++ b/update-server-info.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "exec_cmd.h" static const char update_server_info_usage[] = "git update-server-info [--force]"; @@ -19,6 +20,8 @@ int main(int ac, char **av) if (i != ac) usage(update_server_info_usage); + git_extract_argv0_path(av[0]); + setup_git_directory(); return !!update_server_info(force); diff --git a/upload-pack.c b/upload-pack.c index e5adbc011..5db6f9395 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -616,6 +616,8 @@ int main(int argc, char **argv) int i; int strict = 0; + git_extract_argv0_path(argv[0]); + for (i = 1; i < argc; i++) { char *arg = argv[i]; diff --git a/var.c b/var.c index f1eb314e8..7362ed873 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,8 @@ int main(int argc, char **argv) usage(var_usage); } + git_extract_argv0_path(argv[0]); + setup_git_directory_gently(&nongit); val = NULL;