From: Nguyễn Thái Ngọc Duy Date: Fri, 6 Aug 2010 02:40:35 +0000 (-0500) Subject: git wrapper: introduce startup_info struct X-Git-Tag: v1.7.3-rc0~33^2~13 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e37c1329fa86683c828f04b51bad8bae03939ced;p=git.git 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 --- diff --git a/cache.h b/cache.h index c9fa3df7f..0822c3b8b 100644 --- a/cache.h +++ b/cache.h @@ -1097,6 +1097,11 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix); char *alias_lookup(const char *alias); int split_cmdline(char *cmdline, const char ***argv); +/* git.c */ +struct startup_info { +}; +extern struct startup_info *startup_info; + /* builtin/merge.c */ int checkout_fast_forward(const unsigned char *from, const unsigned char *to); diff --git a/environment.c b/environment.c index 83d38d3c2..eeb26876a 100644 --- a/environment.c +++ b/environment.c @@ -53,6 +53,7 @@ enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE; char *notes_ref_name; int grafts_replace_parents = 1; int core_apply_sparse_checkout; +struct startup_info *startup_info; /* Parallel index stat data preload? */ int core_preload_index = 0; diff --git a/git.c b/git.c index f37028b3b..c4b6dbea3 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";