summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Prohaska <prohaska@zib.de>2009-01-18 12:00:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-26 08:26:05 (GMT)
commit2fb3f6db96492b680899f9e40f434eeb4c778a84 (patch)
tree34fc6bc48403648216d8864fabcf28effb14c15a
parent2cd72b0b290e40fb4d6a925ce26603503f01aa09 (diff)
downloadgit-2fb3f6db96492b680899f9e40f434eeb4c778a84.zip
git-2fb3f6db96492b680899f9e40f434eeb4c778a84.tar.gz
git-2fb3f6db96492b680899f9e40f434eeb4c778a84.tar.bz2
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 <prohaska@zib.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--daemon.c2
-rw-r--r--fast-import.c3
-rw-r--r--hash-object.c3
-rw-r--r--http-push.c2
-rw-r--r--imap-send.c3
-rw-r--r--index-pack.c3
-rw-r--r--merge-index.c3
-rw-r--r--merge-tree.c3
-rw-r--r--mktag.c3
-rw-r--r--mktree.c3
-rw-r--r--pack-redundant.c3
-rw-r--r--patch-id.c3
-rw-r--r--unpack-file.c3
-rw-r--r--update-server-info.c3
-rw-r--r--upload-pack.c2
-rw-r--r--var.c3
16 files changed, 45 insertions, 0 deletions
diff --git a/daemon.c b/daemon.c
index 540700e..d93cf96 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 f0e08ac..1935206 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<<PACK_ID_BITS)-1)
@@ -2406,6 +2407,8 @@ int main(int argc, const char **argv)
{
unsigned int i, show_stats = 1;
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen)
diff --git a/hash-object.c b/hash-object.c
index 846e91a..37e6677 100644
--- a/hash-object.c
+++ b/hash-object.c
@@ -8,6 +8,7 @@
#include "blob.h"
#include "quote.h"
#include "parse-options.h"
+#include "exec_cmd.h"
static void hash_fd(int fd, const char *type, int write_object, const char *path)
{
@@ -81,6 +82,8 @@ int main(int argc, const char **argv)
type = blob_type;
+ git_extract_argv0_path(argv[0]);
+
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, hash_object_options, hash_object_usage, 0);
diff --git a/http-push.c b/http-push.c
index 6ad853e..a99fdfc 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2184,6 +2184,8 @@ int main(int argc, char **argv)
struct ref *ref;
char *rewritten_url = NULL;
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
remote = xcalloc(sizeof(*remote), 1);
diff --git a/imap-send.c b/imap-send.c
index c3fa0df..f91293c 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -23,6 +23,7 @@
*/
#include "cache.h"
+#include "exec_cmd.h"
#ifdef NO_OPENSSL
typedef void *SSL;
#endif
@@ -1389,6 +1390,8 @@ int main(int argc, char **argv)
int total, n = 0;
int nongit_ok;
+ git_extract_argv0_path(argv[0]);
+
/* init the random number generator */
arc4_init();
diff --git a/index-pack.c b/index-pack.c
index 2931511..72c41fd 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -8,6 +8,7 @@
#include "tree.h"
#include "progress.h"
#include "fsck.h"
+#include "exec_cmd.h"
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] [--strict] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
@@ -880,6 +881,8 @@ int main(int argc, char **argv)
struct pack_idx_entry **idx_objects;
unsigned char pack_sha1[20];
+ git_extract_argv0_path(argv[0]);
+
/*
* We wish to read the repository's config file if any, and
* for that it is necessary to call setup_git_directory_gently().
diff --git a/merge-index.c b/merge-index.c
index 7827e87..c00a2b3 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "run-command.h"
+#include "exec_cmd.h"
static const char *pgm;
static const char *arguments[9];
@@ -93,6 +94,8 @@ int main(int argc, char **argv)
if (argc < 3)
usage("git-merge-index [-o] [-q] <merge-program> (-a | [--] <filename>*)");
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
read_cache();
diff --git a/merge-tree.c b/merge-tree.c
index 2d1413e..f18201a 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 <base-tree> <branch1> <branch2>";
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 ba3d495..6d5083e 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 514fd9b..6283bc3 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 e93eb96..48a12bc 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 871f1d2..3660ad4 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 bcdc8bb..6dd8ad0 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 <sha1>");
if (get_sha1(argv[1], sha1))
diff --git a/update-server-info.c b/update-server-info.c
index 7e8209e..7b38fd8 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 e5adbc0..5db6f93 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 f1eb314..7362ed8 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 | <variable>]";
@@ -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;