From: Steffen Prohaska <prohaska@zib.de>
To: Johannes Sixt <johannes.sixt@telecom.at>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Steffen Prohaska <prohaska@zib.de>
Subject: [PATCH 5/7] Add calls to git_extract_argv0_path() in programs that call git_config_*
Date: Sun, 17 Aug 2008 14:44:41 +0200 [thread overview]
Message-ID: <1218977083-14526-6-git-send-email-prohaska@zib.de> (raw)
In-Reply-To: <1218977083-14526-5-git-send-email-prohaska@zib.de>
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.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
daemon.c | 3 +++
fast-import.c | 4 ++++
hash-object.c | 4 ++++
index-pack.c | 4 ++++
unpack-file.c | 4 ++++
var.c | 4 ++++
6 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/daemon.c b/daemon.c
index 8dcde73..172854e 100644
--- a/daemon.c
+++ b/daemon.c
@@ -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.
*/
diff --git a/fast-import.c b/fast-import.c
index 7089e6f..7789d60 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)
@@ -2394,6 +2395,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)
diff --git a/hash-object.c b/hash-object.c
index 46c06a9..0f77a46 100644
--- a/hash-object.c
+++ b/hash-object.c
@@ -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++) {
diff --git a/index-pack.c b/index-pack.c
index 52064be..bd5983b 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>] }";
@@ -877,6 +878,9 @@ int main(int argc, char **argv)
struct pack_idx_entry **idx_objects;
unsigned char sha1[20];
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
git_config(git_index_pack_config, NULL);
for (i = 1; i < argc; i++) {
diff --git a/unpack-file.c b/unpack-file.c
index bcdc8bb..f8bfda7 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,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))
diff --git a/var.c b/var.c
index f1eb314..33457dc 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,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;
--
1.6.0.rc3.22.g053fd
next prev parent reply other threads:[~2008-08-17 12:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-17 12:44 [PATCH 0/7] prefix discovery at runtime (on Windows) Steffen Prohaska
2008-08-17 12:44 ` [PATCH 1/7] Windows: Add workaround for MSYS' path conversion Steffen Prohaska
2008-08-17 12:44 ` [PATCH 2/7] system_path(): Add prefix computation at runtime if RUNTIME_PREFIX set Steffen Prohaska
2008-08-17 12:44 ` [PATCH 3/7] Refactor git_set_argv0_path() to git_extract_argv0_path() Steffen Prohaska
2008-08-17 12:44 ` [PATCH 4/7] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack Steffen Prohaska
2008-08-17 12:44 ` Steffen Prohaska [this message]
2008-08-17 12:44 ` [PATCH 6/7] Modify setup_path() to only add git_exec_path() to PATH Steffen Prohaska
2008-08-17 12:44 ` [PATCH 7/7] Windows: Revert to default paths and convert them by RUNTIME_PREFIX Steffen Prohaska
2008-08-17 20:28 ` [PATCH 6/7] Modify setup_path() to only add git_exec_path() to PATH Johannes Sixt
2008-08-17 20:43 ` [PATCH 2/7] system_path(): Add prefix computation at runtime if RUNTIME_PREFIX set Johannes Sixt
2008-08-18 5:28 ` Steffen Prohaska
2008-08-17 20:35 ` [PATCH 1/7] Windows: Add workaround for MSYS' path conversion Johannes Sixt
2008-09-21 7:48 ` Steffen Prohaska
2008-08-17 18:01 ` [PATCH 0/7] prefix discovery at runtime (on Windows) Junio C Hamano
2008-09-08 22:50 ` Junio C Hamano
2008-09-09 14:49 ` Johannes Schindelin
-- strict thread matches above, loose matches on Subject: below --
2008-09-21 16:24 [PATCH 0/7 v2] " Steffen Prohaska
2008-09-21 16:24 ` [PATCH 1/7] Windows: Add workaround for MSYS' path conversion Steffen Prohaska
2008-09-21 16:24 ` [PATCH 2/7] system_path(): Add prefix computation at runtime if RUNTIME_PREFIX set Steffen Prohaska
2008-09-21 16:24 ` [PATCH 3/7] Refactor git_set_argv0_path() to git_extract_argv0_path() Steffen Prohaska
2008-09-21 16:24 ` [PATCH 4/7] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack Steffen Prohaska
2008-09-21 16:24 ` [PATCH 5/7] Add calls to git_extract_argv0_path() in programs that call git_config_* Steffen Prohaska
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1218977083-14526-6-git-send-email-prohaska@zib.de \
--to=prohaska@zib.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.sixt@telecom.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).