fix: git cmd (#38084)

This commit is contained in:
wxiaoguang
2026-06-12 13:35:59 +08:00
committed by GitHub
parent 4f4a0a79ac
commit f5a97b7518
4 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
repo *repo_model.Repository
gitRepo *git.Repository
)
defer gitRepo.Close() // it's safe to call Close on a nil pointer
defer func() { _ = gitRepo.Close() }() // it's safe to call Close on a nil pointer, but it needs to use the latest value
updates := make([]*repo_module.PushUpdateOptions, 0, len(opts.OldCommitIDs))
wasEmpty := false