Open
[转交] git-repo tree 不支持 --path 且 --depth recursive 在 gitcode 直接 400 #357
马岩松Add on  2 days ago
马岩松
马岩松Collaborators
2 days ago Create

目标

grape git-repo tree 支持子目录过滤(--path),并在 GitCode 平台对 --depth recursive 的限制前置到参数校验/帮助文档,避免调用后才返回 400。

现状

  • grape git-repo tree --ref <branch> --path src/api 报 --path 不存在;tree 仅支持 --ref/--depth 等参数。
  • --help 仅在说明里标注 depth=recursive 为 GitHub-only,未对 GitCode 前置提示。
  • 改用 --depth recursive 在 GitCode 直接返回 HTTP 400「该平台(gitcode)暂不支持递归树」,错误只有在实际调用后才暴露。
  • 目录枚举只能逐个 contents --path <dir> 多次往返,目录级浏览成本高。
  • 本机复现确认:CLI grape 0.3.4;与历史 issue #12178「tree 参数与实列不符」为不同根因,本条是 CLI 能力缺口 + 平台差异未前置告知。

期望行为

  1. tree 增加 --path 子路径过滤(服务端映射 git/trees + path 前缀截取)。
  2. --help 明确「GitCode 不支持 recursive」,并在参数校验期即返回可读错误(而非调用后 HTTP 400);同时给出 contents 逐层列目录的推荐用法示例。

验收标准

优先级

P2(一般)


来源:grape-dev/grape#3987(由 VOD Agent 归仓判断转交)
auto-submitted by VOD Agent

likedislike
grape_bot
grape_botCollaborators
2 days ago Comments:

[VOD Agent] 已复核本条,结论:诉求已被仓库内既有 Issue 覆盖,建议本条按重复件处理(原始 Issue 描述不改写)。

复现结果(grape 0.3.4 / 契约 v2.3.0a1 / 本仓 grape-dev/grape-cli / ref=ldw)

  • grape git-repo tree --path src → Error: No such option '--path'. Did you mean '--depth'?(--path 能力缺口,与描述一致)
  • grape git-repo tree --depth recursive → HTTP 400: 该平台(gitcode)暂不支持递归树:recursive 返回破碎树(丢失 blob),请用单层或 Git 仓库等效接口(调用后才失败,与描述一致)
  • grape git-repo tree --help 当前已含 “depth=recursive is GitHub-only (GitCode rejects it)”,说明「帮助文档标注平台差异」部分已由 #234 交付;仍缺的参数校验期前置报错归 #309
  • --depth single 正常返回,逐层 contents --path 仍是当前唯一可用路径

覆盖关系

本条诉求 既有 Issue 现状
tree --path 子目录过滤 #11(含 grape_cli/registry.py 实现方案与完整验收标准) 已出 Spec,待实现
同上(路径前缀列子树 / contents 目录直接返条目,二选一) #315 已收敛,与 #11 同一能力
--depth recursive 在 GitCode 前置拒绝 / 自动降级 #309(bug / cli-contract / P2 / spec-ready,已出 Spec) 已 triage,待实现
recursive 文案误导(pulls files 仍宣传 recursive 为回退方案) #234 已关闭
--depth 非法值静默按单层处理 #50 处理中

建议

  1. 本条可作为重复件关闭:--path 诉求计入 #11,recursive 400 前置校验诉求计入 #309,无需在第三条 Issue 上重复排期。
  2. #315 与 #11 指向同一能力(一次性列出子树),建议二者择一保留为主跟踪项,避免同一实现被并行领取。
  3. #11 / #309 合入后,本条四个验收项可逐项对照勾选归档。

本次未发起交办:能力实现已在 #11 / #309 的评审与实现队列中,重复交办会造成同一改动多次排期。

likedislike