Install the default branch through `archive/HEAD` instead of trying `main` then `master`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 73/100
Hướng nghiên cứu
Bắt đầu tại crates/quarto-source-fetch/src/target.rs, nơi các đích owner/repo đơn giản hiện thử tải các archive main và master. Đọc cách xử lý tải archive và chuyển hướng, sau đó kiểm tra cách commit đã phân giải được ghi lại. Hoàn thành khi một repository đơn giản được cài đặt từ nhánh mặc định trên GitHub, kể cả khi nhánh đó có tên khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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:
- Ngôn ngữ chính
- Rust
- Star
- 302
- Fork
- 22
- Merge trung bình
- 5 giờ 2 phút
- Pull request đã merge (30 ngày)
- 213
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quarto-dev/q2
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/q2#1219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
quarto-dev/q2#1188 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
quarto-dev/q2#1133 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quarto-dev/q2#1103 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
quarto-dev/q2#1095 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quarto-dev/q2
Issue tương tự
-
Selected chart highlights only its values, not its series names and category labelsCó thể đã có người làm @Higgs32584 đã nhận hôm nay. Đang mởbug priority: low ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
storytold/gridcraft#4390 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug bugfix priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
BurntSushi/jiff#713 ·
Maintainer thường phản hồi trong vòng 1 ngày