summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-12-31 04:30:19 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-12-31 06:22:13 (GMT)
commitad1a382fbb3ecb1bb017854a470816c815cc46c9 (patch)
tree6961232bd690d5a6c328b80302042a32271c2680 /upload-pack.c
parent45b097947d6297a4b3f1016b05c66cdc15b411c2 (diff)
downloadgit-ad1a382fbb3ecb1bb017854a470816c815cc46c9.zip
git-ad1a382fbb3ecb1bb017854a470816c815cc46c9.tar.gz
git-ad1a382fbb3ecb1bb017854a470816c815cc46c9.tar.bz2
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 'upload-pack.c')
0 files changed, 0 insertions, 0 deletions