path: root/git.c
diff options
authorNguyễn Thái Ngọc Duy <>2010-08-06 02:40:35 (GMT)
committerJunio C Hamano <>2010-08-11 16:24:00 (GMT)
commite37c1329fa86683c828f04b51bad8bae03939ced (patch)
treec481315cc7b7bfd3ce938f06b35946e5bb6b35c5 /git.c
parent0d0ba03a18a9c6cbc3d55c1b6834b9c3824f823f (diff)
git wrapper: introduce startup_info struct
The startup_info struct will collect information managed by the git setup code, such as the prefix for relative paths passed on the command line (i.e., path to the starting cwd from the toplevel of the work tree) and whether a git repository has been found. In other words, startup_info is intended to be a collection of global variables with results that were previously returned from setup functions. This state is global anyway (since the cwd is), even if it is not currently tracked that way. Letting these values persist means there is more flexibility in deciding when to run setup. For now, the struct is empty. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'git.c')
1 files changed, 3 insertions, 0 deletions
diff --git a/git.c b/git.c
index f37028b..c4b6dbe 100644
--- a/git.c
+++ b/git.c
@@ -14,6 +14,7 @@ const char git_usage_string[] =
const char git_more_info_string[] =
"See 'git help COMMAND' for more information on a specific command.";
+static struct startup_info git_startup_info;
static int use_pager = -1;
struct pager_config {
const char *cmd;
@@ -489,6 +490,8 @@ int main(int argc, const char **argv)
const char *cmd;
+ startup_info = &git_startup_info;
cmd = git_extract_argv0_path(argv[0]);
if (!cmd)
cmd = "git-help";