Refactor git command stdio pipe (#36393)

And remove the incorrect `ensureValidGitRepository`
This commit is contained in:
wxiaoguang
2026-01-18 02:11:46 +08:00
committed by GitHub
parent 7a2aac406d
commit 149f7a6f1f
9 changed files with 210 additions and 122 deletions
-10
View File
@@ -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