Improve repo-age’s reliability#3201
Conversation
Co-authored-by: Fregante <opensource@bfred.it>
Co-authored-by: Fregante <opensource@bfred.it>
repo-agerepo-age’s reliability
Co-authored-by: Fregante <opensource@bfred.it>
Co-authored-by: Flo Edelmann <florian-edelmann@online.de>
source/features/repo-age.tsx
Outdated
| const timeStamp = select('relative-time', commit)!.attributes.datetime.value; | ||
| const {pathname} = select<HTMLAnchorElement>('a.message', commit)!; | ||
| return [timeStamp, pathname]; | ||
| return getRepoAge(commitSha, commitsCount - Math.min(6, commitsCount)); |
There was a problem hiding this comment.
We want all from the last commit - 6 (Which is 5 its complicated but I thnk 0 and 1 are the same)
I will double check give me a min
There was a problem hiding this comment.
Yes 0 and 1 are the same
Try it move the 1886 to 1887 and 1888
{
repository(owner: "sindresorhus", name: "refined-github") {
defaultBranchRef {
target {
... on Commit {
history(first: 5, after: "208835085ee2a78b6a9d4f30b1407c7eac1b88b3 1886") {
nodes {
authoredDate
committedDate
resourcePath
}
}
}
}
}
}
}
There was a problem hiding this comment.
We want 5, 1 =0 (I think)
There was a problem hiding this comment.
OK the math is like this. We are at commit 10 and we want AFTER commit 10 so we need to start from number 9 = (10 - (1 + 5) )
There was a problem hiding this comment.
So the math belongs to getRepoAge, not outside.
5 is inside and 6 is outside; doesn't make sense.
| return getRepoAge(commitSha, commitsCount - Math.min(6, commitsCount)); | |
| return getRepoAge(commitSha, commitsCount); |
There was a problem hiding this comment.
We have commit number 1 we want the last 5. There are 1000 commits. If we do 1 + 1000 (The commit count) we get commit number 1001 which does not exist.
So we need to go back 1 and then another 5 to get the last 5.
There was a problem hiding this comment.
The latest version looks right
Co-authored-by: Fregante <opensource@bfred.it>
|
I'll leave that for @FloEdelmann. I promise he will do a better job 🥇. |

LINKED ISSUES:
Fixes AngularJS repository marked as being 51 years old #3185
TEST URLS:
https://github.com/angular/angular.js
https://github.com/torvalds/linux