Revert replacing setenv() with set_git_dir()

This partially reverts commit
855f254b2b.  All tests still
pass after this revert.  The original commit seems unnecessary.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This commit is contained in:
Steffen Prohaska
2008-01-01 20:34:52 +01:00
parent 9ef5c15d66
commit 24fcae02c3
2 changed files with 4 additions and 4 deletions

6
git.c
View File

@@ -45,14 +45,14 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
fprintf(stderr, "No directory given for --git-dir.\n" );
usage(git_usage_string);
}
set_git_dir( (*argv)[1] );
setenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1);
if (envchanged)
*envchanged = 1;
(*argv)++;
(*argc)--;
handled++;
} else if (!prefixcmp(cmd, "--git-dir=")) {
set_git_dir(cmd + 10);
setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);
if (envchanged)
*envchanged = 1;
} else if (!strcmp(cmd, "--work-tree")) {
@@ -72,7 +72,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
} else if (!strcmp(cmd, "--bare")) {
static char git_dir[PATH_MAX+1];
is_bare_repository_cfg = 1;
set_git_dir(getcwd(git_dir, sizeof(git_dir)));
setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 0);
if (envchanged)
*envchanged = 1;
} else {

2
path.c
View File

@@ -255,7 +255,7 @@ char *enter_repo(char *path, int strict)
if (access("objects", X_OK) == 0 && access("refs", X_OK) == 0 &&
validate_headref("HEAD") == 0) {
set_git_dir(".");
setenv(GIT_DIR_ENVIRONMENT, ".", 1);
check_repository_format();
return path;
}