aboutsummaryrefslogtreecommitdiffstats
path: root/services/context
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2025-01-04 18:47:24 +0800
committerGitHub <noreply@github.com>2025-01-04 18:47:24 +0800
commit3d544a3ad35f221d48591757ae3beaab0820e4ff (patch)
tree276d01830c81fff870a3af68e184b525c45125c1 /services/context
parent2b064b8637dee3904e882baada99221204f4f874 (diff)
downloadgitea-3d544a3ad35f221d48591757ae3beaab0820e4ff.tar.gz
gitea-3d544a3ad35f221d48591757ae3beaab0820e4ff.zip
Fix empty git repo handling logic (#33101)
Fix #33092
Diffstat (limited to 'services/context')
-rw-r--r--services/context/repo.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/services/context/repo.go b/services/context/repo.go
index 2a473f4a54..63529e1d81 100644
--- a/services/context/repo.go
+++ b/services/context/repo.go
@@ -897,10 +897,8 @@ func RepoRefByType(detectRefType RepoRefType, opts ...RepoRefByTypeOptions) func
refName = brs[0].Name
} else if len(brs) == 0 {
log.Error("No branches in non-empty repository %s", ctx.Repo.GitRepo.Path)
- ctx.Repo.Repository.MarkAsBrokenEmpty()
} else {
log.Error("GetBranches error: %v", err)
- ctx.Repo.Repository.MarkAsBrokenEmpty()
}
}
ctx.Repo.RefName = refName
@@ -911,7 +909,6 @@ func RepoRefByType(detectRefType RepoRefType, opts ...RepoRefByTypeOptions) func
} else if strings.Contains(err.Error(), "fatal: not a git repository") || strings.Contains(err.Error(), "object does not exist") {
// if the repository is broken, we can continue to the handler code, to show "Settings -> Delete Repository" for end users
log.Error("GetBranchCommit: %v", err)
- ctx.Repo.Repository.MarkAsBrokenEmpty()
} else {
ctx.ServerError("GetBranchCommit", err)
return