HasObject returns whether or not the repo contains an object with the given hash.
(hash string)
| 127 | |
| 128 | // HasObject returns whether or not the repo contains an object with the given hash. |
| 129 | func (repo *GitRepo) HasObject(hash string) (bool, error) { |
| 130 | _, err := repo.runGitCommand("cat-file", "-e", hash) |
| 131 | if err == nil { |
| 132 | // We verified the object exists |
| 133 | return true, nil |
| 134 | } |
| 135 | if _, ok := err.(*exec.ExitError); ok { |
| 136 | return false, nil |
| 137 | } |
| 138 | // Got an unexpected error |
| 139 | return false, err |
| 140 | } |
| 141 | |
| 142 | // GetPath returns the path to the repo. |
| 143 | func (repo *GitRepo) GetPath() string { |
nothing calls this directly
no test coverage detected