python / python/cpython

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

Aperta
#156,064 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

infra type-bug
Lingua principale
Python
Stelle
77.2k
Fork
36k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in Tools/patchcheck/patchcheck.py, in get_git_upstream_remote(), e verifica come viene filtrato l’output di git remote -v. Riproduci il problema con un partial clone usando --filter=blob:none e verifica che il remote di fetch upstream venga rilevato e incluso nell’output dell’errore quando appropriato. Il lavoro è completato quando patchcheck riconosce il remote upstream nonostante il testo aggiunto [blob:none]; la PR collegata gh-156065 è già presente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, python
Ambito
tooling
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.