gosrc: only count commits for a forked repo after created

Fixes #492

Change-Id: I00d9b82d6022346919bfc1120099adb3683d003c
Reviewed-on: https://go-review.googlesource.com/47352
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
diff --git a/gosrc/github.go b/gosrc/github.go
index 276a1fa..e107496 100644
--- a/gosrc/github.go
+++ b/gosrc/github.go
@@ -181,6 +181,7 @@
 
 // isQuickFork reports whether the repository is a "quick fork":
 // it has fewer than 3 commits, all within a week of the repo creation, createdAt.
+// Commits must be in reverse chronological order by Commit.Committer.Date.
 func isQuickFork(commits []*githubCommit, createdAt time.Time) bool {
 	oneWeekOld := createdAt.Add(7 * 24 * time.Hour)
 	if oneWeekOld.After(time.Now()) {
@@ -191,6 +192,9 @@
 		if commit.Commit.Committer.Date.After(oneWeekOld) {
 			return false
 		}
+		if commit.Commit.Committer.Date.Before(createdAt) {
+			break
+		}
 		n++
 	}
 	return n < 3