aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/iterator.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-07-12 17:48:57 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-07-23 17:18:04 +0200
commit612264a00f352a12620bab3c72cd0b11b304f5e2 (patch)
treeff4d2d73b14c04cc8dce78a6e942db1ee7c77e04 /bridge/gitlab/iterator.go
parent6c02f0951da7962ccdcc50628887ef4eda2eb3b7 (diff)
downloadgit-bug-612264a00f352a12620bab3c72cd0b11b304f5e2.tar.gz
bridge/gitlab: fix iterator out of index bug
Diffstat (limited to 'bridge/gitlab/iterator.go')
-rw-r--r--bridge/gitlab/iterator.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/bridge/gitlab/iterator.go b/bridge/gitlab/iterator.go
index 724d1c73..a0f2907b 100644
--- a/bridge/gitlab/iterator.go
+++ b/bridge/gitlab/iterator.go
@@ -106,7 +106,7 @@ func (i *iterator) NextIssue() bool {
}
// move cursor index
- if i.issue.index < min(i.capacity, len(i.issue.cache)) {
+ if i.issue.index < min(i.capacity, len(i.issue.cache))-1 {
i.issue.index++
return true
}
@@ -126,6 +126,7 @@ func (i *iterator) NextIssue() bool {
i.issue.page++
i.issue.index = 0
i.comment.index = 0
+ i.issue.cache = issues
return true
}
@@ -149,6 +150,10 @@ func (i *iterator) getComments() ([]*gitlab.Note, error) {
return notes, err
}
+func (i *iterator) getNextComments() bool {
+ return false
+}
+
func (i *iterator) NextComment() bool {
if i.err != nil {
return false
@@ -168,6 +173,7 @@ func (i *iterator) NextComment() bool {
return false
}
+ i.comment.cache = comments
i.comment.page++
i.comment.index = 0
@@ -175,7 +181,7 @@ func (i *iterator) NextComment() bool {
}
// move cursor index
- if i.comment.index < min(i.capacity, len(i.comment.cache)) {
+ if i.comment.index < min(i.capacity, len(i.comment.cache))-1 {
i.comment.index++
return true
}
@@ -193,6 +199,7 @@ func (i *iterator) NextComment() bool {
return false
}
+ i.comment.cache = comments
i.comment.page++
i.comment.index = 0