fix(repo): +tree 未指定 --ref 时遵循仓库默认分支(修复 main 默认分支仓库 404) #337

Merged
wbtiger merged 2 commits from Taoyouce/gitlink-cli:fix/repo-tree-default-branch into master 2026-07-14 22:24:10 +08:00
Contributor

问题

repo +tree 未指定 --ref 时把 ref 硬编码为 master,对默认分支是 main(或其他名称)的仓库直接返回 [-2] 你访问的文件不存在(生产实测 datawhalechina/paper-chart-tutorial,默认分支 main)。平台 sub_entries API 在不带 ref 参数时会自动使用仓库默认分支。

变更

  • --ref 未指定时不再发送 ref 参数(交由平台落到默认分支),flag 不再声明 master 默认值
  • 更新单测:默认 ref 断言改为「不携带 ref 参数」
  • 补充 doc/changes/repo-tree-default-branch.md

验证

  • go test ./shortcuts/repo/ / go vet / gofmt 全绿
  • 生产 gitlink.org.cn 实测:默认分支为 main(datawhalechina/paper-chart-tutorial)与 master(gitlink/gitlink-cli)的仓库均正常列出根目录
## 问题 `repo +tree` 未指定 `--ref` 时把 ref 硬编码为 `master`,对默认分支是 `main`(或其他名称)的仓库直接返回 `[-2] 你访问的文件不存在`(生产实测 `datawhalechina/paper-chart-tutorial`,默认分支 `main`)。平台 `sub_entries` API 在不带 `ref` 参数时会自动使用仓库默认分支。 ## 变更 - `--ref` 未指定时不再发送 `ref` 参数(交由平台落到默认分支),flag 不再声明 `master` 默认值 - 更新单测:默认 ref 断言改为「不携带 ref 参数」 - 补充 `doc/changes/repo-tree-default-branch.md` ## 验证 - `go test ./shortcuts/repo/` / `go vet` / gofmt 全绿 - 生产 gitlink.org.cn 实测:默认分支为 `main`(datawhalechina/paper-chart-tutorial)与 `master`(gitlink/gitlink-cli)的仓库均正常列出根目录
Taoyouce added 1 commit 2026-07-05 20:26:20 +08:00
fcde26823b fix(repo): +tree respects repository default branch when --ref omitted
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Taoyouce added 1 commit 2026-07-05 20:34:33 +08:00
2dd580c208 fix: branch/pr/release default-branch awareness (drop hardcoded master)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
wbtiger merged commit dd3783d998 into master 2026-07-14 22:24:10 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Gitlink/gitlink-cli#337
No description provided.