Install the default branch through `archive/HEAD` instead of trying `main` then `master`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
crates/quarto-source-fetch/src/target.rsから始めてください。ここでは、単純なowner/repoターゲットが現在、mainとmasterのアーカイブを試しています。アーカイブのダウンロードとリダイレクトの処理を読み、解決されたコミットがどのように記録されるかを確認してください。単純なリポジトリがGitHubのデフォルトブランチからインストールされ、そのブランチ名が別の名前でも動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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:
- 主要言語
- Rust
- スター
- 302
- フォーク
- 22
- 平均マージ
- 5時間 2分
- マージ済み PR(30日)
- 213
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/q2 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/q2#1219 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
quarto-dev/q2#1188 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
quarto-dev/q2#1133 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
quarto-dev/q2#1103 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
quarto-dev/q2#1095 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Selected chart highlights only its values, not its series names and category labels対応中かも @Higgs32584 が今日担当しました。 オープンbug priority: low ui
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
storytold/gridcraft#4390 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
bug bugfix priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
BurntSushi/jiff#713 ·
メンテナーはふだん 1 日以内に返信