MCPcopy Index your code
hub / github.com/google/git-appraise / VerifyCommit

Method VerifyCommit

repository/git.go:188–198  ·  view source on GitHub ↗

VerifyCommit verifies that the supplied hash points to a known commit.

(hash string)

Source from the content-addressed store, hash-verified

186
187// VerifyCommit verifies that the supplied hash points to a known commit.
188func (repo *GitRepo) VerifyCommit(hash string) error {
189 out, err := repo.runGitCommand("cat-file", "-t", hash)
190 if err != nil {
191 return err
192 }
193 objectType := strings.TrimSpace(string(out))
194 if objectType != "commit" {
195 return fmt.Errorf("Hash %q points to a non-commit object of type %q", hash, objectType)
196 }
197 return nil
198}
199
200// VerifyGitRef verifies that the supplied ref points to a known commit.
201func (repo *GitRepo) VerifyGitRef(ref string) error {

Callers

nothing calls this directly

Calls 1

runGitCommandMethod · 0.95

Tested by

no test coverage detected