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)
| 494 | // |
| 495 | // If the specified ref does not exist, then this method returns an empty result. |
| 496 | func (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 | // |
nothing calls this directly
no test coverage detected