Install the default branch through `archive/HEAD` instead of trying `main` then `master`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 73/100
Línea de trabajo
Empieza en crates/quarto-source-fetch/src/target.rs, donde los destinos simples owner/repo prueban actualmente los archivos main y master. Lee cómo se gestionan la descarga del archivo y las redirecciones, y luego comprueba cómo se registra el commit resuelto. Se considera terminado cuando un repositorio simple se instala desde su rama predeterminada de GitHub, incluso si esa rama tiene otro nombre.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Context
For a plain owner/repo, crates/quarto-source-fetch/src/target.rs tries archive/refs/heads/main, then archive/refs/heads/master.
When the default branch has another name, q2 either fails, or installs a branch that isn't the default.
https://github.com/mcanouil/q2-default-branch-demo shows the second case.
Its default branch is develop, with the demo extension at version 2.0.0.
An older main branch has the same extension at version 1.0.0.
$ q2 add mcanouil/q2-default-branch-demo --trust --no-prompt
The following changes will be made in .:
Demo [Install] 1.0.0 (filter)
q2 installs version 1.0.0 from main.
The record it writes has no ref and no commit, so nothing shows later that the install came from a branch that isn't the default:
version: 1
source: mcanouil/q2-default-branch-demo
kind: github
files:
_extension.yml: b57dd1f9313c1b622ed19918e48134119762128b5612b709918317c10b63cef3
demo.lua: 2150321a3a3a341aebde685226d403639b195ff507c1a45b9b6ab23fc4ee5f26
Proposal
Download https://github.com/<owner>/<repo>/archive/HEAD.tar.gz for the default branch.
GitHub answers with a redirect that names the commit at the head of the default branch:
$ curl -sI https://github.com/mcanouil/q2-default-branch-demo/archive/HEAD.tar.gz | grep -i '^location'
location: https://codeload.github.com/mcanouil/q2-default-branch-demo/tar.gz/0cb98bf577f198e0417d163bc589e8dfb9ae2e96
archive/refs/heads/main redirects to .../tar.gz/refs/heads/main, with no commit.
Why
It removes the guess at the branch name, and needs no API call or token.
Benefits
q2 add owner/repo installs the default branch of any repository, whatever its name.
q2 learns the installed commit for free, which https://github.com/quarto-dev/q2/issues/1178 needs.
Other tools that install from GitHub, such as Quarto Wizard, can use the same URL and get the same commit for the same input.
Related:
- Lenguaje dominante
- Rust
- Estrellas
- 302
- Forks
- 22
- Merge medio
- 5 h 2 min
- PR fusionados (30 d)
- 213
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de quarto-dev/q2
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
quarto-dev/q2#1219 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
quarto-dev/q2#1188 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
quarto-dev/q2#1133 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
quarto-dev/q2#1103 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
quarto-dev/q2#1095 ·
Los mantenedores suelen responder en 1 día
Todos los issues de quarto-dev/q2
Issues similares
-
Selected chart highlights only its values, not its series names and category labelsPosiblemente ocupada @Higgs32584 la tomó hoy. Abiertobug priority: low ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
storytold/gridcraft#4390 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
bug bugfix priority: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
BurntSushi/jiff#713 ·
Los mantenedores suelen responder en 1 día