def is_git_dir(self):
    '\n        判断是否为git目录\n\n        @param path:\n        @return:\n        '
    d = (self.path + '/.git')
    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 (osp.isfile(osp.join(d, 'gitdir')) and osp.isfile(osp.join(d, 'commondir')) and osp.isfile(osp.join(d, 'gitfile'))):
            return False
    return False
判断是否为git目录

@param path:
@return:
def is_git_dir(self):
    '\n        判断是否为git目录\n\n        @param path:\n        @return:\n        '
    d = (self.path + '/.git')
    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 (osp.isfile(osp.join(d, 'gitdir')) and osp.isfile(osp.join(d, 'commondir')) and osp.isfile(osp.join(d, 'gitfile'))):
            return False
    return False