From: Junio C Hamano Date: Tue, 28 Aug 2007 05:41:23 +0000 (-0700) Subject: git --bare cmd: do not unconditionally nuke GIT_DIR X-Git-Tag: v1.5.3-rc7~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9277d60233a1829742aa2d9d20ddbfc3b2b7acde;p=git.git git --bare cmd: do not unconditionally nuke GIT_DIR "GIT_DIR=some.where git --bare cmd" and worse yet "git --git-dir=some.where --bare cmd" were very confusing. They both ignored git-dir specified, and instead made $cwd as GIT_DIR. This changes --bare not to override existing GIT_DIR. This has been like this for a long time. Let's hope nobody sane relied on this insane behaviour. Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git.txt b/Documentation/git.txt index 3b0d53025..75b3e1b87 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -120,7 +120,10 @@ OPTIONS variable. --bare:: - Same as --git-dir=`pwd`. + Treat the repository as a bare repository. If GIT_DIR + environment is not set, it is set to the current working + directory. + FURTHER DOCUMENTATION --------------------- diff --git a/git.c b/git.c index b6e292e29..fd3d83cd4 100644 --- a/git.c +++ b/git.c @@ -94,7 +94,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; - setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 1); + setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 0); if (envchanged) *envchanged = 1; } else {