summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75c384e)
raw | patch | inline | side by side (parent: 75c384e)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 19 Dec 2006 09:28:15 +0000 (01:28 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 19 Dec 2006 09:51:51 +0000 (01:51 -0800) |
We broke the discipline Linus set up to allow compiler help us
avoid typos in environment names in the early days of git over
time. This defines a handful preprocessor constants for
environment variable names used in relatively core parts of the
system.
I've left out variable names specific to subsystems such as HTTP
and SSL as I do not think they are big problems.
Signed-off-by: Junio C Hamano <junkio@cox.net>
avoid typos in environment names in the early days of git over
time. This defines a handful preprocessor constants for
environment variable names used in relatively core parts of the
system.
I've left out variable names specific to subsystems such as HTTP
and SSL as I do not think they are big problems.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-init-db.c | patch | blob | history | |
builtin-repo-config.c | patch | blob | history | |
cache.h | patch | blob | history | |
config.c | patch | blob | history | |
exec_cmd.c | patch | blob | history | |
merge-recursive.c | patch | blob | history |
diff --git a/builtin-init-db.c b/builtin-init-db.c
index c8ed5c2a0b8837c443be790eb6b4b520c6d6373b..01f366ad0bf5860aaf9123ef5d5653c612871a9f 100644 (file)
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -125,7 +125,7 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
DIR *dir;
if (!template_dir) {
- template_dir = getenv("GIT_TEMPLATE_DIR");
+ template_dir = getenv(TEMPLATE_DIR_ENVIRONMENT);
if (!template_dir)
template_dir = DEFAULT_GIT_TEMPLATE_DIR;
}
diff --git a/builtin-repo-config.c b/builtin-repo-config.c
index a38099a63d20d6f4a8187770c84e3a180ebeaa52..4885930ca460ba1143089c9a050ff55f4682a912 100644 (file)
--- a/builtin-repo-config.c
+++ b/builtin-repo-config.c
char *global = NULL, *repo_config = NULL;
const char *local;
- local = getenv("GIT_CONFIG");
+ local = getenv(CONFIG_ENVIRONMENT);
if (!local) {
const char *home = getenv("HOME");
- local = getenv("GIT_CONFIG_LOCAL");
+ local = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!local)
local = repo_config = xstrdup(git_path("config"));
if (home)
index 8ad5920d2be9593ad7810e3ccefa1c8b9f4e0750..4943056c19ffb72a7cfb994daaa788ec1b01d60b 100644 (file)
--- a/cache.h
+++ b/cache.h
#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
#define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
+#define TEMPLATE_DIR_ENVIRONMENT "GIT_TEMPLATE_DIR"
+#define CONFIG_ENVIRONMENT "GIT_CONFIG"
+#define CONFIG_LOCAL_ENVIRONMENT "GIT_CONFIG_LOCAL"
+#define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH"
extern int is_bare_git_dir(const char *dir);
extern const char *get_git_dir(void);
diff --git a/config.c b/config.c
index 663993fefa9d8c347d2ff4c1b40edbf3b0d19c90..6a4224e98cf51f8ced2b8e942231012b42aaeef7 100644 (file)
--- a/config.c
+++ b/config.c
* $GIT_CONFIG_LOCAL will make it process it in addition to the
* global config file, the same way it would the per-repository
* config file otherwise. */
- filename = getenv("GIT_CONFIG");
+ filename = getenv(CONFIG_ENVIRONMENT);
if (!filename) {
home = getenv("HOME");
- filename = getenv("GIT_CONFIG_LOCAL");
+ filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!filename)
filename = repo_config = xstrdup(git_path("config"));
}
char* lock_file;
const char* last_dot = strrchr(key, '.');
- config_filename = getenv("GIT_CONFIG");
+ config_filename = getenv(CONFIG_ENVIRONMENT);
if (!config_filename) {
- config_filename = getenv("GIT_CONFIG_LOCAL");
+ config_filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!config_filename)
config_filename = git_path("config");
}
int out_fd;
char buf[1024];
- config_filename = getenv("GIT_CONFIG");
+ config_filename = getenv(CONFIG_ENVIRONMENT);
if (!config_filename) {
- config_filename = getenv("GIT_CONFIG_LOCAL");
+ config_filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!config_filename)
config_filename = git_path("config");
}
diff --git a/exec_cmd.c b/exec_cmd.c
index 5d6a1247b4a1955dffae2b52da064a6eb489d83b..3996bce33fe11b8f0bae120fabd40a74c66de342 100644 (file)
--- a/exec_cmd.c
+++ b/exec_cmd.c
if (current_exec_path)
return current_exec_path;
- env = getenv("GIT_EXEC_PATH");
+ env = getenv(EXEC_PATH_ENVIRONMENT);
if (env && *env) {
return env;
}
char git_command[PATH_MAX + 1];
int i;
const char *paths[] = { current_exec_path,
- getenv("GIT_EXEC_PATH"),
+ getenv(EXEC_PATH_ENVIRONMENT),
builtin_exec_path };
for (i = 0; i < ARRAY_SIZE(paths); ++i) {
diff --git a/merge-recursive.c b/merge-recursive.c
index 6dd6e2e5af779f2b3ad5da050776c37646b45a84..ae4dcfbe5b0b8b1e9a03df128b9d0b67706a371b 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
struct commit *result, *h1, *h2;
git_config(git_default_config); /* core.filemode */
- original_index_file = getenv("GIT_INDEX_FILE");
+ original_index_file = getenv(INDEX_ENVIRONMENT);
if (!original_index_file)
original_index_file = xstrdup(git_path("index"));