Browse Source

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>
maint
Steffen Prohaska 16 years ago committed by Junio C Hamano
parent
commit
2fb3f6db96
  1. 2
      daemon.c
  2. 3
      fast-import.c
  3. 3
      hash-object.c
  4. 2
      http-push.c
  5. 3
      imap-send.c
  6. 3
      index-pack.c
  7. 3
      merge-index.c
  8. 3
      merge-tree.c
  9. 3
      mktag.c
  10. 3
      mktree.c
  11. 3
      pack-redundant.c
  12. 3
      patch-id.c
  13. 3
      unpack-file.c
  14. 3
      update-server-info.c
  15. 2
      upload-pack.c
  16. 3
      var.c

2
daemon.c

@ -937,6 +937,8 @@ int main(int argc, char **argv)
gid_t gid = 0; gid_t gid = 0;
int i; int i;


git_extract_argv0_path(argv[0]);

for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
char *arg = argv[i]; char *arg = argv[i];



3
fast-import.c

@ -150,6 +150,7 @@ Format of STDIN stream:
#include "refs.h" #include "refs.h"
#include "csum-file.h" #include "csum-file.h"
#include "quote.h" #include "quote.h"
#include "exec_cmd.h"


#define PACK_ID_BITS 16 #define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1) #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; unsigned int i, show_stats = 1;


git_extract_argv0_path(argv[0]);

setup_git_directory(); setup_git_directory();
git_config(git_pack_config, NULL); git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen) if (!pack_compression_seen && core_compression_seen)

3
hash-object.c

@ -8,6 +8,7 @@
#include "blob.h" #include "blob.h"
#include "quote.h" #include "quote.h"
#include "parse-options.h" #include "parse-options.h"
#include "exec_cmd.h"


static void hash_fd(int fd, const char *type, int write_object, const char *path) 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; type = blob_type;


git_extract_argv0_path(argv[0]);

git_config(git_default_config, NULL); git_config(git_default_config, NULL);


argc = parse_options(argc, argv, hash_object_options, hash_object_usage, 0); argc = parse_options(argc, argv, hash_object_options, hash_object_usage, 0);

2
http-push.c

@ -2184,6 +2184,8 @@ int main(int argc, char **argv)
struct ref *ref; struct ref *ref;
char *rewritten_url = NULL; char *rewritten_url = NULL;


git_extract_argv0_path(argv[0]);

setup_git_directory(); setup_git_directory();


remote = xcalloc(sizeof(*remote), 1); remote = xcalloc(sizeof(*remote), 1);

3
imap-send.c

@ -23,6 +23,7 @@
*/ */


#include "cache.h" #include "cache.h"
#include "exec_cmd.h"
#ifdef NO_OPENSSL #ifdef NO_OPENSSL
typedef void *SSL; typedef void *SSL;
#endif #endif
@ -1389,6 +1390,8 @@ int main(int argc, char **argv)
int total, n = 0; int total, n = 0;
int nongit_ok; int nongit_ok;


git_extract_argv0_path(argv[0]);

/* init the random number generator */ /* init the random number generator */
arc4_init(); arc4_init();



3
index-pack.c

@ -8,6 +8,7 @@
#include "tree.h" #include "tree.h"
#include "progress.h" #include "progress.h"
#include "fsck.h" #include "fsck.h"
#include "exec_cmd.h"


static const char index_pack_usage[] = static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] [--strict] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }"; "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; struct pack_idx_entry **idx_objects;
unsigned char pack_sha1[20]; unsigned char pack_sha1[20];


git_extract_argv0_path(argv[0]);

/* /*
* We wish to read the repository's config file if any, and * We wish to read the repository's config file if any, and
* for that it is necessary to call setup_git_directory_gently(). * for that it is necessary to call setup_git_directory_gently().

3
merge-index.c

@ -1,5 +1,6 @@
#include "cache.h" #include "cache.h"
#include "run-command.h" #include "run-command.h"
#include "exec_cmd.h"


static const char *pgm; static const char *pgm;
static const char *arguments[9]; static const char *arguments[9];
@ -93,6 +94,8 @@ int main(int argc, char **argv)
if (argc < 3) if (argc < 3)
usage("git-merge-index [-o] [-q] <merge-program> (-a | [--] <filename>*)"); usage("git-merge-index [-o] [-q] <merge-program> (-a | [--] <filename>*)");


git_extract_argv0_path(argv[0]);

setup_git_directory(); setup_git_directory();
read_cache(); read_cache();



3
merge-tree.c

@ -2,6 +2,7 @@
#include "tree-walk.h" #include "tree-walk.h"
#include "xdiff-interface.h" #include "xdiff-interface.h"
#include "blob.h" #include "blob.h"
#include "exec_cmd.h"


static const char merge_tree_usage[] = "git-merge-tree <base-tree> <branch1> <branch2>"; static const char merge_tree_usage[] = "git-merge-tree <base-tree> <branch1> <branch2>";
static int resolve_directories = 1; static int resolve_directories = 1;
@ -344,6 +345,8 @@ int main(int argc, char **argv)
if (argc != 4) if (argc != 4)
usage(merge_tree_usage); usage(merge_tree_usage);


git_extract_argv0_path(argv[0]);

setup_git_directory(); setup_git_directory();


buf1 = get_tree_descriptor(t+0, argv[1]); buf1 = get_tree_descriptor(t+0, argv[1]);

3
mktag.c

@ -1,5 +1,6 @@
#include "cache.h" #include "cache.h"
#include "tag.h" #include "tag.h"
#include "exec_cmd.h"


/* /*
* A signature file has a very simple fixed format: four lines * A signature file has a very simple fixed format: four lines
@ -159,6 +160,8 @@ int main(int argc, char **argv)
if (argc != 1) if (argc != 1)
usage("git-mktag < signaturefile"); usage("git-mktag < signaturefile");


git_extract_argv0_path(argv[0]);

setup_git_directory(); setup_git_directory();


if (strbuf_read(&buf, 0, 4096) < 0) { if (strbuf_read(&buf, 0, 4096) < 0) {

3
mktree.c

@ -6,6 +6,7 @@
#include "cache.h" #include "cache.h"
#include "quote.h" #include "quote.h"
#include "tree.h" #include "tree.h"
#include "exec_cmd.h"


static struct treeent { static struct treeent {
unsigned mode; unsigned mode;
@ -70,6 +71,8 @@ int main(int ac, char **av)
unsigned char sha1[20]; unsigned char sha1[20];
int line_termination = '\n'; int line_termination = '\n';


git_extract_argv0_path(av[0]);

setup_git_directory(); setup_git_directory();


while ((1 < ac) && av[1][0] == '-') { while ((1 < ac) && av[1][0] == '-') {

3
pack-redundant.c

@ -7,6 +7,7 @@
*/ */


#include "cache.h" #include "cache.h"
#include "exec_cmd.h"


#define BLKSIZE 512 #define BLKSIZE 512


@ -601,6 +602,8 @@ int main(int argc, char **argv)
unsigned char *sha1; unsigned char *sha1;
char buf[42]; /* 40 byte sha1 + \n + \0 */ char buf[42]; /* 40 byte sha1 + \n + \0 */


git_extract_argv0_path(argv[0]);

setup_git_directory(); setup_git_directory();


for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {

3
patch-id.c

@ -1,4 +1,5 @@
#include "cache.h" #include "cache.h"
#include "exec_cmd.h"


static void flush_current_id(int patchlen, unsigned char *id, git_SHA_CTX *c) 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) if (argc != 1)
usage(patch_id_usage); usage(patch_id_usage);


git_extract_argv0_path(argv[0]);

generate_id_list(); generate_id_list();
return 0; return 0;
} }

3
unpack-file.c

@ -1,5 +1,6 @@
#include "cache.h" #include "cache.h"
#include "blob.h" #include "blob.h"
#include "exec_cmd.h"


static char *create_temp_file(unsigned char *sha1) static char *create_temp_file(unsigned char *sha1)
{ {
@ -25,6 +26,8 @@ int main(int argc, char **argv)
{ {
unsigned char sha1[20]; unsigned char sha1[20];


git_extract_argv0_path(argv[0]);

if (argc != 2) if (argc != 2)
usage("git-unpack-file <sha1>"); usage("git-unpack-file <sha1>");
if (get_sha1(argv[1], sha1)) if (get_sha1(argv[1], sha1))

3
update-server-info.c

@ -1,4 +1,5 @@
#include "cache.h" #include "cache.h"
#include "exec_cmd.h"


static const char update_server_info_usage[] = static const char update_server_info_usage[] =
"git update-server-info [--force]"; "git update-server-info [--force]";
@ -19,6 +20,8 @@ int main(int ac, char **av)
if (i != ac) if (i != ac)
usage(update_server_info_usage); usage(update_server_info_usage);


git_extract_argv0_path(av[0]);

setup_git_directory(); setup_git_directory();


return !!update_server_info(force); return !!update_server_info(force);

2
upload-pack.c

@ -616,6 +616,8 @@ int main(int argc, char **argv)
int i; int i;
int strict = 0; int strict = 0;


git_extract_argv0_path(argv[0]);

for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
char *arg = argv[i]; char *arg = argv[i];



3
var.c

@ -4,6 +4,7 @@
* Copyright (C) Eric Biederman, 2005 * Copyright (C) Eric Biederman, 2005
*/ */
#include "cache.h" #include "cache.h"
#include "exec_cmd.h"


static const char var_usage[] = "git var [-l | <variable>]"; static const char var_usage[] = "git var [-l | <variable>]";


@ -56,6 +57,8 @@ int main(int argc, char **argv)
usage(var_usage); usage(var_usage);
} }


git_extract_argv0_path(argv[0]);

setup_git_directory_gently(&nongit); setup_git_directory_gently(&nongit);
val = NULL; val = NULL;



Loading…
Cancel
Save