Exemple #1
0
func getIsSubmittedCheck(repo repository.Repo) func(ref, commit string) bool {
	refCommitsMap := make(map[string]map[string]bool)

	getRefCommitsMap := func(ref string) map[string]bool {
		commitsMap, ok := refCommitsMap[ref]
		if ok {
			return commitsMap
		}
		commitsMap = make(map[string]bool)
		for _, commit := range repo.ListCommits(ref) {
			commitsMap[commit] = true
		}
		refCommitsMap[ref] = commitsMap
		return commitsMap
	}

	return func(ref, commit string) bool {
		return getRefCommitsMap(ref)[commit]
	}
}