@matheusbsbs / matheus-bagliano / commits / 9277d60233
Fork 0

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 <gitster@pobox.com>

Junio C Hamano committed Aug 27, 2007 at 22:41 UTC 9277d60233a1829742aa2d9d20ddbfc3b2b7acde
2 files changed +5 -2
Documentation/git.txt
+4 -1
@@ -120,7 +120,10 @@ OPTIONS
120 variable.
121
122 --bare::
123 - Same as --git-dir=`pwd`.
123 + Treat the repository as a bare repository. If GIT_DIR
124 + environment is not set, it is set to the current working
125 + directory.
126 +
127
128 FURTHER DOCUMENTATION
129 ---------------------
git.c
+1 -1
@@ -94,7 +94,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
94 } else if (!strcmp(cmd, "--bare")) {
95 static char git_dir[PATH_MAX+1];
96 is_bare_repository_cfg = 1;
97 - setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 1);
97 + setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 0);
98 if (envchanged)
99 *envchanged = 1;
100 } else {