Skip to content

Commit 7627943

Browse files
matledgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 59c9392 commit 7627943

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

builtin-config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ int cmd_config(int argc, const char **argv, const char *prefix)
178178
char *home = getenv("HOME");
179179
if (home) {
180180
char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
181-
setenv("GIT_CONFIG", user_config, 1);
181+
setenv(CONFIG_ENVIRONMENT, user_config, 1);
182182
free(user_config);
183183
} else {
184184
die("$HOME not set");
185185
}
186186
}
187187
else if (!strcmp(argv[1], "--system"))
188-
setenv("GIT_CONFIG", ETC_GITCONFIG, 1);
188+
setenv(CONFIG_ENVIRONMENT, ETC_GITCONFIG, 1);
189189
else if (!strcmp(argv[1], "--null") || !strcmp(argv[1], "-z")) {
190190
term = '\0';
191191
delim = '\n';

path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ char *enter_repo(char *path, int strict)
252252

253253
if (access("objects", X_OK) == 0 && access("refs", X_OK) == 0 &&
254254
validate_headref("HEAD") == 0) {
255-
setenv("GIT_DIR", ".", 1);
255+
setenv(GIT_DIR_ENVIRONMENT, ".", 1);
256256
check_repository_format();
257257
return path;
258258
}

0 commit comments

Comments
 (0)