Documentation
¶
Overview ¶
Package git 封装通过 Gitea API 操作远端 Git 仓库的基础设施能力。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateRepoWithRetry ¶ added in v0.2.5
func CreateRepoWithRetry(ctx context.Context, client *gitea.Client, opts gitea.CreateRepoOption) (*gitea.Repository, error)
CreateRepoWithRetry 创建 Gitea 仓库,包含超时控制与退避重试。 对网络类错误(非 409/403)最多重试 createRepoMaxRetry 次。
func InitRepoStructure ¶
InitRepoStructure 通过 Gitea API 向指定仓库写入初始内容文件 (.gitignore 与 .leros/memory/.gitkeep)。
行为:
- client 为 nil 或 fullName 不符合 owner/repo 格式时返回 error
- 单个文件创建会使用独立超时 context 与重试,不受调用方 ctx 取消影响
- 多次重试后仍失败会记录告警并继续尝试其余文件
- 若存在任一文件失败,最终返回聚合后的 error
调用方应根据业务语义决定是否容忍该 error。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.