patchcheck does not recognise the upstream remote in a partial clone (git remote -v appends "[blob:none]")
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
make patchcheck fails to find the upstream remote in a partial clone (git clone --filter=blob:none ...), even when the remote is named upstream and points at https://github.com/python/cpython:
ValueError: Patchcheck was unable to find an unambiguous upstream remote, with URL matching 'https://github.com/python/cpython'. For help creating an upstream remote, see Dev Guide: https://devguide.python.org/getting-started/git-boot-camp/#cloning-a-forked-cpython-repository
Remotes found:
origin https://github.com/ekanshul/cpython.git (fetch)
Since Git 2.37 (git/git@ef6d15ca53), git remote -v appends the object filter of a promisor remote to its fetch line:
$ git remote -v
origin https://github.com/ekanshul/cpython.git (fetch)
origin https://github.com/ekanshul/cpython.git (push)
upstream https://github.com/python/cpython.git (fetch) [blob:none]
upstream https://github.com/python/cpython.git (push)
get_git_upstream_remote() in Tools/patchcheck/patchcheck.py (from #135806) selects fetch lines with remote.endswith("(fetch)"), so the partially-cloned upstream is dropped both from the candidates and from the "Remotes found" list in the error message, which makes the message misleading too. Matching "(fetch)" anywhere on the line fixes it.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS (git 2.50.1)
Linked PRs
- gh-156065
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Tools/patchcheck/patchcheck.py 中的 get_git_upstream_remote() 开始,检查 git remote -v 的输出是如何被过滤的。使用 --filter=blob:none 进行 partial clone 来复现,并验证在适当情况下能够检测到 upstream fetch remote,并将其包含在错误输出中。当 patchcheck 即使面对追加的 [blob:none] 文本仍能识别 upstream remote 时,即表示完成;关联的 PR gh-156065 已经存在。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, python
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100