summaryrefslogtreecommitdiffstats
path: root/modules/git/repo_commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/repo_commit.go')
-rw-r--r--modules/git/repo_commit.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index c5f6d6cdd6..397c390e84 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -454,3 +454,21 @@ func (repo *Repository) getBranches(commit *Commit, limit int) ([]string, error)
}
return branches, nil
}
+
+// GetCommitsFromIDs get commits from commit IDs
+func (repo *Repository) GetCommitsFromIDs(commitIDs []string) (commits *list.List) {
+ if len(commitIDs) == 0 {
+ return nil
+ }
+
+ commits = list.New()
+
+ for _, commitID := range commitIDs {
+ commit, err := repo.GetCommit(commitID)
+ if err == nil && commit != nil {
+ commits.PushBack(commit)
+ }
+ }
+
+ return commits
+}