diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-15 13:42:33 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-16 02:46:32 +0200 |
commit | b02662d4e870a34d2c6d97d4f702fcc1311e5177 (patch) | |
tree | 6f2bc1d942f979b3bb379d833700fe33f955415d /git/repo/fun.py | |
parent | 0210e394e0776d0b7097bf666bebd690ed0c0e4f (diff) | |
download | gitpython-b02662d4e870a34d2c6d97d4f702fcc1311e5177.tar.gz |
src: reduce needless deps to `gitdb.util`
Diffstat (limited to 'git/repo/fun.py')
-rw-r--r-- | git/repo/fun.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/git/repo/fun.py b/git/repo/fun.py index c770fd43..5fe8682d 100644 --- a/git/repo/fun.py +++ b/git/repo/fun.py @@ -6,18 +6,11 @@ from git.compat import xrange from git.exc import WorkTreeRepositoryUnsupported from git.objects import Object from git.refs import SymbolicReference +from git.util import hex_to_bin, bin_to_hex from gitdb.exc import ( BadObject, BadName, ) -from gitdb.util import ( - join, - isdir, - isfile, - dirname, - hex_to_bin, - bin_to_hex -) import os.path as osp @@ -40,13 +33,15 @@ def is_git_dir(d): but at least clearly indicates that we don't support it. There is the unlikely danger to throw if we see directories which just look like a worktree dir, but are none.""" - if isdir(d): - if isdir(join(d, 'objects')) and isdir(join(d, 'refs')): - headref = join(d, 'HEAD') - return isfile(headref) or \ + if osp.isdir(d): + if osp.isdir(osp.join(d, 'objects')) and osp.isdir(osp.join(d, 'refs')): + headref = osp.join(d, 'HEAD') + return osp.isfile(headref) or \ (osp.islink(headref) and os.readlink(headref).startswith('refs')) - elif isfile(join(d, 'gitdir')) and isfile(join(d, 'commondir')) and isfile(join(d, 'gitfile')): + elif (osp.isfile(osp.join(d, 'gitdir')) and + osp.isfile(osp.join(d, 'commondir')) and + osp.isfile(osp.join(d, 'gitfile'))): raise WorkTreeRepositoryUnsupported(d) return False @@ -65,7 +60,7 @@ def find_git_dir(d): if content.startswith('gitdir: '): path = content[8:] if not osp.isabs(path): - path = join(dirname(d), path) + path = osp.join(osp.dirname(d), path) return find_git_dir(path) # end handle exception return None |