1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 22:56:07 +02:00

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>
This commit is contained in:
Steffen Prohaska 2009-01-18 13:00:12 +01:00 committed by Junio C Hamano
parent 2cd72b0b29
commit 2fb3f6db96
16 changed files with 45 additions and 0 deletions

View File

@ -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];

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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().

View File

@ -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();

View File

@ -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]);

View File

@ -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) {

View File

@ -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] == '-') {

View File

@ -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++) {

View File

@ -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;
}

View File

@ -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))

View File

@ -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);

View File

@ -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];

3
var.c
View File

@ -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;