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.
This commit is contained in:
Steffen Prohaska
2008-08-17 08:58:21 +02:00
parent 2a7e0eeb48
commit 9599d56740
6 changed files with 23 additions and 0 deletions

View File

@@ -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.
*/

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)
@@ -2395,6 +2396,9 @@ int main(int argc, const char **argv)
{
unsigned int i, show_stats = 1;
if (argv[0] && *argv[0])
git_extract_argv0_path(argv[0]);
setup_git_directory();
git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen)

View File

@@ -7,6 +7,7 @@
#include "cache.h"
#include "blob.h"
#include "quote.h"
#include "exec_cmd.h"
static void hash_object(const char *path, enum object_type type, int write_object)
{
@@ -65,6 +66,9 @@ int main(int argc, char **argv)
int hashstdin = 0;
int stdin_paths = 0;
if (argv[0] && *argv[0])
git_extract_argv0_path(argv[0]);
git_config(git_default_config, NULL);
for (i = 1 ; i < argc; i++) {

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>] }";
@@ -877,6 +878,9 @@ int main(int argc, char **argv)
unsigned char pack_sha1[20];
int nongit = 0;
if (argv[0] && *argv[0])
git_extract_argv0_path(argv[0]);
setup_git_directory_gently(&nongit);
git_config(git_index_pack_config, NULL);

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,9 @@ int main(int argc, char **argv)
{
unsigned char sha1[20];
if (argv[0] && *argv[0])
git_extract_argv0_path(argv[0]);
if (argc != 2)
usage("git-unpack-file <sha1>");
if (get_sha1(argv[1], sha1))

4
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,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;