@matheusbsbs / matheus-bagliano / commits / 7627943a1b
Fork 0

getenv/setenv: use constants if available

There were places using "GIT_DIR" instead of GIT_DIR_ENVIRONMENT and "GIT_CONFIG" instead of CONFIG_ENVIRONMENT. This makes it easier to find all places touching an environment variable using git grep or similar tools. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthias Lederhofer committed Jun 28, 2007 at 16:15 UTC 7627943a1bb0cda6f37b66381a62facf9e200285
2 files changed +3 -3
builtin-config.c
+2 -2
@@ -178,14 +178,14 @@ int cmd_config(int argc, const char **argv, const char *prefix)
178 char *home = getenv("HOME");
179 if (home) {
180 char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
181 - setenv("GIT_CONFIG", user_config, 1);
181 + setenv(CONFIG_ENVIRONMENT, user_config, 1);
182 free(user_config);
183 } else {
184 die("$HOME not set");
185 }
186 }
187 else if (!strcmp(argv[1], "--system"))
188 - setenv("GIT_CONFIG", ETC_GITCONFIG, 1);
188 + setenv(CONFIG_ENVIRONMENT, ETC_GITCONFIG, 1);
189 else if (!strcmp(argv[1], "--null") || !strcmp(argv[1], "-z")) {
190 term = '\0';
191 delim = '\n';
path.c
+1 -1
@@ -252,7 +252,7 @@ char *enter_repo(char *path, int strict)
252
253 if (access("objects", X_OK) == 0 && access("refs", X_OK) == 0 &&
254 validate_headref("HEAD") == 0) {
255 - setenv("GIT_DIR", ".", 1);
255 + setenv(GIT_DIR_ENVIRONMENT, ".", 1);
256 check_repository_format();
257 return path;
258 }