aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github/iterator.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-05-04 22:26:54 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-05-05 18:16:10 +0200
commit7d0296337287ed3d5a97f15c64d51d24340f2567 (patch)
treefbc4c350dc648f72f5f8a0cae71801d04816a06b /bridge/github/iterator.go
parenteec17050f1fbc8565dcd117329b24c201ac476b1 (diff)
downloadgit-bug-7d0296337287ed3d5a97f15c64d51d24340f2567.tar.gz
Add old importer comments in the iterator
Test operation authors Fix typo in test repo url
Diffstat (limited to 'bridge/github/iterator.go')
-rw-r--r--bridge/github/iterator.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/bridge/github/iterator.go b/bridge/github/iterator.go
index 239b49bd..48e98f17 100644
--- a/bridge/github/iterator.go
+++ b/bridge/github/iterator.go
@@ -100,6 +100,8 @@ func (i *iterator) initTimelineQueryVariables() {
i.timeline.variables["issueSince"] = githubv4.DateTime{Time: i.since}
i.timeline.variables["timelineFirst"] = githubv4.Int(i.capacity)
i.timeline.variables["timelineAfter"] = (*githubv4.String)(nil)
+ // Fun fact, github provide the comment edition in reverse chronological
+ // order, because haha. Look at me, I'm dying of laughter.
i.timeline.variables["issueEditLast"] = githubv4.Int(i.capacity)
i.timeline.variables["issueEditBefore"] = (*githubv4.String)(nil)
i.timeline.variables["commentEditLast"] = githubv4.Int(i.capacity)
@@ -278,7 +280,16 @@ func (i *iterator) NextIssueEdit() bool {
return i.queryIssueEdit()
}
- // if there is no edits
+ // if there is no edit, the UserContentEdits given by github is empty. That
+ // means that the original message is given by the issue message.
+ //
+ // if there is edits, the UserContentEdits given by github contains both the
+ // original message and the following edits. The issue message give the last
+ // version so we don't care about that.
+ //
+ // the tricky part: for an issue older than the UserContentEdits API, github
+ // doesn't have the previous message version anymore and give an edition
+ // with .Diff == nil. We have to filter them.
if len(i.timeline.query.Repository.Issues.Nodes[0].UserContentEdits.Nodes) == 0 {
return false
}