问题描述
所以我在脚本中使用 gitpython 来获取提交的开始分支。它适用于某些人,但对于其他人,我最终会遇到如下错误:
[10] => Failed to process commit: Cmd('git') Failed due to: exit code(128)
[11] => cmdline: git branch -a --contains SHA --sort=committerdate
[12] => stderr: 'fatal: Couldn't read .git/packed-refs: Stale file handle'
[13] => Failed to process commit: Cmd('git') Failed due to: exit code(128)
[14] => cmdline: git diff-tree SHA SHA -r --abbrev=40 --full-index -M --raw -z --no-color
这是我使用的行,它产生错误:
repo = git.Repo(self.repo_path)
branch = repo.git.branch('-a','--contains',commit.hexsha,'--sort=committerdate').split('\n')[0].split("remotes/origin/")[-1].split('* ')[-1] if repo.git.branch('-a','--sort=committerdate').split('\n')[0].split("remotes/origin/")[-1].split('* ')[-1] else ''
更多信息:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)