python / python/cpython

patchcheck does not recognise the upstream remote in a partial clone (git remote -v appends "[blob:none]")

Offen
#156,064 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

infra type-bug
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in Tools/patchcheck/patchcheck.py bei get_git_upstream_remote() und untersuche, wie die Ausgabe von git remote -v gefiltert wird. Reproduziere das mit einem Partial Clone unter Verwendung von --filter=blob:none und überprüfe, dass das Upstream-Fetch-Remote erkannt und bei Bedarf in die Fehlerausgabe aufgenommen wird. Erledigt ist die Aufgabe, wenn patchcheck das Upstream-Remote trotz des angehängten Texts [blob:none] erkennt; der verknüpfte PR gh-156065 ist bereits vorhanden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
git, python
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.