diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-04-11 09:58:54 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-04-11 10:01:39 +0800 |
commit | eb792ea76888970d486323df07105129abbbe466 (patch) | |
tree | d2df97029594d6aab65e690069a5d2dafdab7f5d | |
parent | 5db2e0c666ea65fd15cf1c27d95e529d9e1d1661 (diff) | |
download | gitpython-eb792ea76888970d486323df07105129abbbe466.tar.gz |
When using GIT_OBJECT_DIRECTORY, don't require presence of 'objects' subdirectory
This will work for default git object databases only, which use git as
object database directly.
Related to #1000
-rw-r--r-- | git/repo/fun.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/git/repo/fun.py b/git/repo/fun.py index 784a70bf..e3a7bc57 100644 --- a/git/repo/fun.py +++ b/git/repo/fun.py @@ -35,7 +35,8 @@ def is_git_dir(d): There is the unlikely danger to throw if we see directories which just look like a worktree dir, but are none.""" if osp.isdir(d): - if osp.isdir(osp.join(d, 'objects')) and osp.isdir(osp.join(d, 'refs')): + if (osp.isdir(osp.join(d, 'objects')) or os.environ.has_key('GIT_OBJECT_DIRECTORY')) \ + and osp.isdir(osp.join(d, 'refs')): headref = osp.join(d, 'HEAD') return osp.isfile(headref) or \ (osp.islink(headref) and |