def is_git_dir(d): """From git's setup.c:is_git_directory().""" if core.isdir(d) and core.isdir(join(d, "objects")) and core.isdir(join(d, "refs")): headref = join(d, "HEAD") return core.isfile(headref) or (core.islink(headref) and core.readlink(headref).startswith("refs")) return is_git_file(d)
def is_git_dir(d): """From git's setup.c:is_git_directory().""" if (core.isdir(d) and core.isdir(join(d, 'objects')) and core.isdir(join(d, 'refs'))): headref = join(d, 'HEAD') return (core.isfile(headref) or (core.islink(headref) and core.readlink(headref).startswith('refs'))) return is_git_file(d)
def is_git_dir(git_dir): """From git's setup.c:is_git_directory().""" result = False if git_dir: headref = join(git_dir, 'HEAD') if (core.isdir(git_dir) and core.isdir(join(git_dir, 'objects')) and core.isdir(join(git_dir, 'refs'))): result = (core.isfile(headref) or (core.islink(headref) and core.readlink(headref).startswith('refs/'))) else: result = is_git_file(git_dir) return result
def is_git_dir(git_dir): """From git's setup.c:is_git_directory().""" result = False if git_dir: headref = join(git_dir, 'HEAD') if (core.isdir(git_dir) and (core.isdir(join(git_dir, 'objects')) and core.isdir(join(git_dir, 'refs'))) or (core.isfile(join(git_dir, 'gitdir')) and core.isfile(join(git_dir, 'commondir')))): result = (core.isfile(headref) or (core.islink(headref) and core.readlink(headref).startswith('refs/'))) else: result = is_git_file(git_dir) return result