From e299f2b8cdb1aa3074ddaaa95221ec786425ac2f Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sat, 17 Jan 2026 11:27:08 +0800 Subject: [PATCH] remove dead code --- modules/git/repo_commit_gogit.go | 10 ---------- modules/git/repo_commit_nogogit.go | 9 --------- 2 files changed, 19 deletions(-) diff --git a/modules/git/repo_commit_gogit.go b/modules/git/repo_commit_gogit.go index c84aabde1a..550d153722 100644 --- a/modules/git/repo_commit_gogit.go +++ b/modules/git/repo_commit_gogit.go @@ -67,16 +67,6 @@ func (repo *Repository) ConvertToGitID(commitID string) (ObjectID, error) { return NewIDFromString(actualCommitID) } -// IsCommitExist returns true if given commit exists in current repository. -func (repo *Repository) IsCommitExist(name string) bool { - hash, err := repo.ConvertToGitID(name) - if err != nil { - return false - } - _, err = repo.gogitRepo.CommitObject(plumbing.Hash(hash.RawValue())) - return err == nil -} - func (repo *Repository) getCommit(id ObjectID) (*Commit, error) { var tagObject *object.Tag diff --git a/modules/git/repo_commit_nogogit.go b/modules/git/repo_commit_nogogit.go index 2cdccb99a5..2ddb527502 100644 --- a/modules/git/repo_commit_nogogit.go +++ b/modules/git/repo_commit_nogogit.go @@ -50,15 +50,6 @@ func (repo *Repository) GetRefCommitID(name string) (string, error) { return info.ID, nil } -// IsCommitExist returns true if given commit exists in current repository. -func (repo *Repository) IsCommitExist(name string) bool { - _, _, err := gitcmd.NewCommand("cat-file", "-e"). - AddDynamicArguments(name). - WithDir(repo.Path). - RunStdString(repo.Ctx) - return err == nil -} - func (repo *Repository) getCommit(id ObjectID) (*Commit, error) { batch, cancel, err := repo.CatFileBatch(repo.Ctx) if err != nil {