已开启
test: git/repo.go core repository parsing logic completely untested #389
aflyingto创建于  6月29日
aflyingto成员
6月29日 创建

发现来源

测试审查 (Agent 3)

位置

git/repo.go:1-151

影响

git/repo.go 包含 151 行仓库引用解析逻辑,是所有命令的依赖基础。包括 HTTP URL 解析 (parseHTTPURL)、SSH URL 解析 (parseSSHURL)、owner/repo 简写格式解析 (ParseRepo)、当前仓库获取 (CurrentRepo)、Clone 操作以及 URL 生成 (Repo.URL/GitURL/String)。这些函数完全缺少直接单元测试。

现有 git_test.go 仅覆盖 ValidateRef/ValidateFetchURL/SafeFetch 等安全相关函数,未测试 Repo 结构体及其方法。

建议

新增 git/repo_test.go,覆盖:

  • ParseRepo 三种格式的 happy path 和 error path
  • parseHTTPURL 的各种 URL 变体(带/不带 .git 后缀、多级路径)
  • parseSSHURL 各种变体和错误格式
  • Repo.URL/GitURL/String 含/不含 Host 的路径
  • CurrentRepo/Clone 使用 build tag //go:build integration 标记
likedislike
Aaflyingto成员
6月29日 添加了label:risk/highscope/git, status/triage,type/test
Aaflyingto成员
7月1日 关联了里程碑:M5: Test Coverage Foundation
Aaflyingto成员
8月9日 删除了label:status/triage
Aaflyingto成员
8月9日 添加了label:status/verified