diff options
Diffstat (limited to '')
-rw-r--r-- | compat/mingw.c | 2 | ||||
-rw-r--r-- | compat/win32/path-utils.c | 2 | ||||
-rw-r--r-- | config.c | 2 | ||||
-rw-r--r-- | environment.h | 25 | ||||
-rw-r--r-- | name-hash.c | 3 | ||||
-rw-r--r-- | path.c | 2 | ||||
-rw-r--r-- | preload-index.c | 3 | ||||
-rw-r--r-- | prompt.c | 2 | ||||
-rw-r--r-- | refs/files-backend.c | 2 | ||||
-rw-r--r-- | sparse-index.c | 2 | ||||
-rw-r--r-- | statinfo.c | 2 | ||||
-rw-r--r-- | t/helper/test-path-utils.c | 2 | ||||
-rw-r--r-- | tree-diff.c | 3 | ||||
-rw-r--r-- | userdiff.c | 2 |
14 files changed, 53 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c index 29d3f09768..5c2080c04c 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "../git-compat-util.h" #include "win32.h" #include <aclapi.h> diff --git a/compat/win32/path-utils.c b/compat/win32/path-utils.c index b658ca3f81..966ef779b9 100644 --- a/compat/win32/path-utils.c +++ b/compat/win32/path-utils.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "../../git-compat-util.h" #include "../../environment.h" @@ -6,6 +6,8 @@ * */ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "abspath.h" #include "advice.h" diff --git a/environment.h b/environment.h index f1a7c645db..934859e1c5 100644 --- a/environment.h +++ b/environment.h @@ -102,6 +102,28 @@ int use_optional_locks(void); const char *get_git_namespace(void); const char *strip_namespace(const char *namespaced_ref); +/* + * TODO: All the below state either explicitly or implicitly relies on + * `the_repository`. We should eventually get rid of these and make the + * dependency on a repository explicit: + * + * - `setup_git_env()` ideally shouldn't exist as it modifies global state, + * namely the environment. The current process shouldn't ever access that + * state via envvars though, but should instead consult a `struct + * repository`. When spawning new processes, we would ideally also pass a + * `struct repository` and then set up the environment variables for the + * child process, only. + * + * - `have_git_dir()` should not have to exist at all. Instead, we should + * decide on whether or not we have a `struct repository`. + * + * - All the global config variables should become tied to a repository. Like + * this, we'd correctly honor repository-local configuration and be able to + * distinguish configuration values from different repositories. + * + * Please do not add new global config variables here. + */ +# ifdef USE_THE_REPOSITORY_VARIABLE void setup_git_env(const char *git_dir); /* @@ -213,4 +235,5 @@ extern const char *comment_line_str; extern char *comment_line_str_to_free; extern int auto_comment_line_char; -#endif +# endif /* USE_THE_REPOSITORY_VARIABLE */ +#endif /* ENVIRONMENT_H */ diff --git a/name-hash.c b/name-hash.c index 3a58ce03d9..95528e3bcd 100644 --- a/name-hash.c +++ b/name-hash.c @@ -5,6 +5,9 @@ * * Copyright (C) 2008 Linus Torvalds */ + +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "environment.h" #include "gettext.h" @@ -2,6 +2,8 @@ * Utilities for paths and pathnames */ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "abspath.h" #include "environment.h" diff --git a/preload-index.c b/preload-index.c index 63fd35d64b..7926eb09a6 100644 --- a/preload-index.c +++ b/preload-index.c @@ -1,6 +1,9 @@ /* * Copyright (C) 2008 Linus Torvalds */ + +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "pathspec.h" #include "dir.h" @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "parse.h" #include "environment.h" diff --git a/refs/files-backend.c b/refs/files-backend.c index 1cff65f6ae..1bbb550f3a 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "../git-compat-util.h" #include "../copy.h" #include "../environment.h" diff --git a/sparse-index.c b/sparse-index.c index 9958656ded..542ca5f411 100644 --- a/sparse-index.c +++ b/sparse-index.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "environment.h" #include "gettext.h" diff --git a/statinfo.c b/statinfo.c index 3c6bc049c1..30a164b0e6 100644 --- a/statinfo.c +++ b/statinfo.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "environment.h" #include "statinfo.h" diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c index bf0e23ed50..f57c8d706a 100644 --- a/t/helper/test-path-utils.c +++ b/t/helper/test-path-utils.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "test-tool.h" #include "abspath.h" #include "environment.h" diff --git a/tree-diff.c b/tree-diff.c index 9252481df3..5eab8af631 100644 --- a/tree-diff.c +++ b/tree-diff.c @@ -1,6 +1,9 @@ /* * Helper functions for tree diff generation */ + +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "diff.h" #include "diffcore.h" diff --git a/userdiff.c b/userdiff.c index 989629149f..d43d8360d1 100644 --- a/userdiff.c +++ b/userdiff.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "config.h" #include "userdiff.h" |