patchcheck does not recognise the upstream remote in a partial clone (git remote -v appends "[blob:none]")
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- 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