mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Add call to git_extract_argv0_path() to various programs
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.
This commit is contained in:
@@ -2170,6 +2170,9 @@ int main(int argc, char **argv)
|
||||
struct ref *ref;
|
||||
char *rewritten_url = NULL;
|
||||
|
||||
if (argv[0] && *argv[0])
|
||||
git_extract_argv0_path(argv[0]);
|
||||
|
||||
setup_git_directory();
|
||||
|
||||
remote = xcalloc(sizeof(*remote), 1);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "cache.h"
|
||||
#include "exec_cmd.h"
|
||||
|
||||
typedef struct store_conf {
|
||||
char *name;
|
||||
@@ -1293,6 +1294,9 @@ main(int argc, char **argv)
|
||||
int r;
|
||||
int total, n = 0;
|
||||
|
||||
if (argv[0] && *argv[0])
|
||||
git_extract_argv0_path(argv[0]);
|
||||
|
||||
/* init the random number generator */
|
||||
arc4_init();
|
||||
|
||||
|
||||
@@ -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,9 @@ int main(int argc, char **argv)
|
||||
if (argc < 3)
|
||||
usage("git-merge-index [-o] [-q] <merge-program> (-a | [--] <filename>*)");
|
||||
|
||||
if (argv[0] && *argv[0])
|
||||
git_extract_argv0_path(argv[0]);
|
||||
|
||||
setup_git_directory();
|
||||
read_cache();
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -345,6 +346,9 @@ int main(int argc, char **argv)
|
||||
if (argc != 4)
|
||||
usage(merge_tree_usage);
|
||||
|
||||
if (argv[0] && *argv[0])
|
||||
git_extract_argv0_path(argv[0]);
|
||||
|
||||
setup_git_directory();
|
||||
|
||||
buf1 = get_tree_descriptor(t+0, argv[1]);
|
||||
|
||||
4
mktag.c
4
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,9 @@ int main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
usage("git-mktag < signaturefile");
|
||||
|
||||
if (argv[0] && *argv[0])
|
||||
git_extract_argv0_path(argv[0]);
|
||||
|
||||
setup_git_directory();
|
||||
|
||||
strbuf_init(&buf, 0);
|
||||
|
||||
4
mktree.c
4
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,9 @@ int main(int ac, char **av)
|
||||
unsigned char sha1[20];
|
||||
int line_termination = '\n';
|
||||
|
||||
if (av[0] && *av[0])
|
||||
git_extract_argv0_path(av[0]);
|
||||
|
||||
setup_git_directory();
|
||||
|
||||
while ((1 < ac) && av[1][0] == '-') {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "cache.h"
|
||||
#include "exec_cmd.h"
|
||||
|
||||
#define BLKSIZE 512
|
||||
|
||||
@@ -601,6 +602,9 @@ int main(int argc, char **argv)
|
||||
unsigned char *sha1;
|
||||
char buf[42]; /* 40 byte sha1 + \n + \0 */
|
||||
|
||||
if (argv[0] && *argv[0])
|
||||
git_extract_argv0_path(argv[0]);
|
||||
|
||||
setup_git_directory();
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "cache.h"
|
||||
#include "exec_cmd.h"
|
||||
|
||||
static void flush_current_id(int patchlen, unsigned char *id, SHA_CTX *c)
|
||||
{
|
||||
@@ -79,6 +80,9 @@ int main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
usage(patch_id_usage);
|
||||
|
||||
if (argv[0] && *argv[0])
|
||||
git_extract_argv0_path(argv[0]);
|
||||
|
||||
generate_id_list();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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,9 @@ int main(int ac, char **av)
|
||||
if (i != ac)
|
||||
usage(update_server_info_usage);
|
||||
|
||||
if (av[0] && *av[0])
|
||||
git_extract_argv0_path(av[0]);
|
||||
|
||||
setup_git_directory();
|
||||
|
||||
return !!update_server_info(force);
|
||||
|
||||
Reference in New Issue
Block a user