Skip to content

Commit

Permalink
git --bare cmd: do not unconditionally nuke GIT_DIR
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
Junio C Hamano committed Aug 28, 2007
1 parent 6adcca3 commit 9277d60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Documentation/git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------
Expand Down
2 changes: 1 addition & 1 deletion git.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9277d60

Please sign in to comment.