Stray `main` tag makes `git pull origin main` a silent no-op (tag shadows branch)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 65/100
Direzione di ricerca
L’issue identifica il tag main creato per errore e indica il comando proposto per eliminarlo git push origin :refs/tags/main. Controlla l’elenco dei tag del repository e conferma che il tag main sia quello descritto, quindi rimuovilo. Verifica che git fetch --dry-run origin main faccia riferimento al branch in seguito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
refs/tags/main (lightweight, → 0b3b528, #44) coexists with refs/heads/main. Git resolves an unqualified refspec by matching refs/tags/<name> before refs/heads/<name> (count_refspec_match() in remote.c), so the very common
git pull origin main
fetches the tag instead of the branch, then merges/rebases onto the tag's old commit. The command still exits 0, so the failure is silent: the checkout never updates.
Reproduction (against 0be7a76)
$ git fetch --dry-run origin main
* tag main -> FETCH_HEAD # expected: branch
$ git pull --rebase origin main
* tag main -> FETCH_HEAD
Already up to date. # exit 0, branch unchanged
A fully qualified refspec behaves correctly:
$ git fetch --dry-run origin refs/heads/main
* branch main -> FETCH_HEAD
Impact
Every client that passes the short branch name to git pull — GUI clients such as UGit do exactly git pull --recurse-submodules origin main, and so do many scripts — silently stops receiving updates. Worse, with pull.rebase=true the local branch can be moved backwards to 0b3b528: rebasing onto an ancestor of HEAD is reported as "already up to date", so the commits above it are dropped from the branch.
We hit precisely this: local main was rewound one commit, and three consecutive pull attempts returned success without applying the ~105 upstream commits. git fetch without a refspec was equally stale, because the branch half of the pull never ran.
git pull with no arguments is unaffected (it resolves branch.<name>.merge rather than matching a remote ref by name), which makes the problem easy to misdiagnose.
Suggested fix
Delete the stray tag — every other tag in this repository follows v*, so main looks accidental:
git push origin :refs/tags/main
(or Releases → Tags → main → Delete in the GitHub UI).
Workaround for affected clients until then
git pull --rebase origin refs/heads/main
Reproduced with git 2.45.2.windows.1 on Windows.
- Lingua principale
- Rust
- Stelle
- 3.5k
- Fork
- 140
- Merge medio
- 15h 32m
- PR unite (30g)
- 27
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/tgrep
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/tgrep
Issue simili
-
Update webpki-root-certsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
rustls/rustls-platform-verifier#262 · 2 commenti · 2 reazioni ·
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
bherbruck/solvecraft#4493 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
IngvarConsulting/unica#1911 ·
I maintainer di solito rispondono entro 1 giorno