Beispiel #1
0
// Find diffs on given commits
//
// If commitish resolves to a single commit, the diff is performed
// between the commit and its parent.
// @return result.Result<*Diff, error>
func DiffCommits(repoPath, commitish string, contextLines uint32) result.Result {
	return gg.WithRepository(repoPath, func(repo *git.Repository) result.Result {
		commits := gg.ResolveCommits(repo, gg.ExpandCommitish(commitish))
		return commits.FlatMap(func(commitRange interface{}) result.Result {
			return diffCommits(repo, commitRange.(*gg.CommitRange), contextLines)
		})
	})
}
Beispiel #2
0
// Find comments in a commit range or on a single commit
// @return result.Result<[]*Comment, error>
func CommentsOnCommittish(repoPath string, committish string) result.Result {
	return gg.WithRepository(repoPath, func(repo *git.Repository) result.Result {
		resolution := gg.ResolveCommits(repo, committish)
		return resolution.FlatMap(func(commitRange interface{}) result.Result {
			return CommentsOnCommits(repo, commitRange.(*gg.CommitRange).Commits())
		})
	})
}