feat: v0.4.0 — 配置架构重构 + 一键多端推送 + 项目级代理控制\n\n架构重构:\n- 配置从 Platform→User→Project 重构为扁平的 Projects+Groups+Credentials 模型\n- 侧边栏完全重写,适配新分组→项目树结构\n- 新增分组(Group)管理和凭据(Credential)管理\n\n新功能:\n- 一键多端推送:Push All 按钮,将当前分支/标签推送到所有远程仓库\n- 项目级代理控制:每个项目独立设置代理(跟随全局/强制开启/强制关闭)\n- GitClient 新增 RunWithProxy 方法,支持按调用级别覆盖全局代理\n- 所有网络操作(Pull/Push/Fetch)均支持项目级代理设置\n\n其他:\n- 新增 CHANGELOG.md 版本更新日志\n- 更新 README/README_CN 文档,反映最新 72+ API 方法\n- 版本号升级到 0.4.0(config.yml/info.json/Info.plist)
Some checks failed
Release / build-windows (push) Has been cancelled
Some checks failed
Release / build-windows (push) Has been cancelled
This commit is contained in:
@@ -29,10 +29,20 @@ func NewGitClient() *GitClient {
|
||||
|
||||
// Run 执行 git 命令,支持超时和代理设置
|
||||
func (g *GitClient) Run(path string, args ...string) (string, error) {
|
||||
return g.RunWithProxy(path, nil, args...)
|
||||
}
|
||||
|
||||
// RunWithProxy 执行 git 命令,useProxy 可覆盖全局代理设置
|
||||
// useProxy == nil 时跟随 GitClient 自身的 Enabled 设置
|
||||
func (g *GitClient) RunWithProxy(path string, useProxy *bool, args ...string) (string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), g.Timeout)
|
||||
defer cancel()
|
||||
header := []string{"-C", path, "-c", "core.quotePath=false"}
|
||||
if g.Enabled {
|
||||
enableProxy := g.Enabled
|
||||
if useProxy != nil {
|
||||
enableProxy = *useProxy
|
||||
}
|
||||
if enableProxy {
|
||||
header = append(header, "-c", "http.proxy="+g.Proxy, "-c", "https.proxy="+g.Proxy)
|
||||
}
|
||||
argsArr := append(header, args...)
|
||||
|
||||
Reference in New Issue
Block a user