git.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:gilt 作者: metacloud 项目源码 文件源码
def _has_branch(version, debug=False):
    """
    Determine a version is a local git branch name or not.

    :param version: A string containing the branch/tag/sha to be determined.
    :param debug: An optional bool to toggle debug output.
    :return: bool
    """
    cmd = sh.git.bake('show-ref', '--verify', '--quiet',
                      "refs/heads/{}".format(version))
    try:
        util.run_command(cmd, debug=debug)
        return True
    except sh.ErrorReturnCode:
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号