`q2 add owner/repo@<sha>` fails for a commit SHA

オープン 初心者向け
#1,005 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@cscheid がすでに取り組んでいます。

2026年11月2日 から。

  • #1006 @cscheid による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
github, rust
領域
tooling

調査の方向性

ref の検索は crates/quarto-source-fetch/src/target.rs の 161〜173 行目付近、parse_github にあります。ここでタグと head のアーカイブ候補が順に試されます。その候補リストと、2xx 以外のレスポンスを読み飛ばすフェッチループを読んでください。q2 add owner/repo@<sha>(完全な SHA と短い SHA の両方)でエクステンションがインストールされ、同名のタグやブランチが引き続き優先されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Bug description

q2 add accepts <gh-org>/<gh-repo>[/<subdir>][@<ref>], the URL of a .zip or .tar.gz archive, or a local archive or folder.
The @<ref> can be a tag or a branch, but not a commit.

For @<ref>, parse_github tries archive/refs/tags/<ref> and then archive/refs/heads/<ref>, and GitHub answers 404 to both when the ref is a commit SHA:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/quarto-source-fetch/src/target.rs#L161-L173

GitHub serves a commit at archive/<sha>.tar.gz, with the full or the short SHA, so the archive exists.
Pinning a commit helps with an extension that has no releases, or when you want to try a fix before it's released.
Quarto 1 has the same gap.

Steps to reproduce
mkdir q2-sha && cd q2-sha
q2 add quarto-ext/fontawesome@6b520912a7b26a72e1b0826f6b201c2e69b2b3c7 --trust --no-prompt
q2 add quarto-ext/fontawesome@6b52091 --trust --no-prompt

For comparison, a tag and the full archive URL both install:

q2 add quarto-ext/[email protected] --trust --no-prompt
q2 add https://github.com/quarto-ext/fontawesome/archive/6b52091.tar.gz --trust --no-prompt
Actual behavior
Error: Could not get an extension from quarto-ext/fontawesome@6b520912a7b26a72e1b0826f6b201c2e69b2b3c7
could not download quarto-ext/fontawesome@6b520912a7b26a72e1b0826f6b201c2e69b2b3c7 on GitHub: tried 2 location(s): https://github.com/quarto-ext/fontawesome/archive/refs/tags/6b520912a7b26a72e1b0826f6b201c2e69b2b3c7.tar.gz → HTTP 404; https://github.com/quarto-ext/fontawesome/archive/refs/heads/6b520912a7b26a72e1b0826f6b201c2e69b2b3c7.tar.gz → HTTP 404

The short SHA fails the same way.
The URL form works, but .quarto-source.yml then records kind: url and the URL, not the repository and the commit.

Expected behavior

The extension installs at that commit.
One way would be to add archive/<ref>.tar.gz as a third candidate after tags and heads.
The fetch loop already moves on after a non-2xx status, so a tag or a branch with the same name still wins.

Your environment
  • q2: Q2 (quarto 2) 0.40.0-nightly.20261101 (nightly built from a2a1cb9).
  • OS: macOS 27.2 (arm64).
  • Terminal, no IDE.
主要言語
Rust
スター
283
フォーク
20
平均マージ
19時間 33分
マージ済み PR(30日)
165

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/q2 のほかの issue

quarto-dev/q2 の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。