diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2006-12-31 07:30:19 +0300 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-31 09:22:13 +0300 |
commit | ad1a382fbb3ecb1bb017854a470816c815cc46c9 (patch) | |
tree | 6961232bd690d5a6c328b80302042a32271c2680 /run-command.c | |
parent | 45b097947d6297a4b3f1016b05c66cdc15b411c2 (diff) |
Automatically detect a bare git repository.
Many users find it unfriendly that they can create a bare git
repository easily with `git clone --bare` but are then unable to
run simple commands like `git log` once they cd into that newly
created bare repository. This occurs because we do not check to
see if the current working directory is a git repository.
Instead of failing out with "fatal: Not a git repository" we should
try to automatically detect if the current working directory is
a bare repository and use that for GIT_DIR, and fail out only if
that doesn't appear to be true.
We test the current working directory only after we have tried
searching up the directory tree. This is to retain backwards
compatibility with our previous behavior on the off chance that
a user has a 'refs' and 'objects' subdirectories and a 'HEAD'
file that looks like a symref, all stored within a repository's
associated working directory.
This change also consolidates the validation logic between the case
of GIT_DIR being supplied and GIT_DIR not being supplied, cleaning
up the code.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'run-command.c')
0 files changed, 0 insertions, 0 deletions