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

Method ListCommits

repository/git.go:496–509  ·  view source on GitHub ↗

ListCommits returns the list of commits reachable from the given ref. The generated list is in chronological order (with the oldest commit first). If the specified ref does not exist, then this method returns an empty result.

(ref string)

Source from the content-addressed store, hash-verified

494//
495// If the specified ref does not exist, then this method returns an empty result.
496func (repo *GitRepo) ListCommits(ref string) []string {
497 var stdout bytes.Buffer
498 var stderr bytes.Buffer
499 if err := repo.runGitCommandWithIO(nil, &stdout, &stderr, "rev-list", "--reverse", ref); err != nil {
500 return nil
501 }
502
503 byteLines := bytes.Split(stdout.Bytes(), []byte("\n"))
504 var commits []string
505 for _, byteLine := range byteLines {
506 commits = append(commits, string(byteLine))
507 }
508 return commits
509}
510
511// ListCommitsBetween returns the list of commits between the two given revisions.
512//

Callers

nothing calls this directly

Calls 1

runGitCommandWithIOMethod · 0.95

Tested by

no test coverage detected