提交 4fa150f6 编写于 作者: M Mort Yao

add util.git

上级 cb9ccc91
#!/usr/bin/env python
import os
def get_head(repo_path):
"""Get (branch, commit) from HEAD of a git repo."""
ref = open(os.path.join(repo_path, '.git', 'HEAD'), 'r').read().strip()[5:].split('/')
return ref[-1], open(os.path.join(repo_path, '.git', *ref), 'r').read().strip()[:7]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册