Feature: https://github.com/sindresorhus/refined-github/pull/2881
The file is currently source/options.html but was renamed twice.
The link we generate should point to the file that existed at the time: extension/options/index.html
The regular blame follows renames, but I'm not sure we (deep-blame) can.
@fregante I'll look into it tomorrow
@fregante looked into it. I dont see a way
Yeah when we implemented the “follow renames” feature we had to pull the rename commit specifically and get the new name from there.
Here we don’t know that commit at all, and even then there may be more than one.
One thing we can do to avoid opening a 404 page is to check the filenames in the PR first. If !associatedPr.fileList.includes(currentFile), alert(file was renamed)
Hmm, That would not work if the PR had more than 100 files No?
Yeah that'd break this feature on some 100+ files PRs. Maybe not worth the change
Is it possible to reach the file from the PR? Not just the files that the PR touches.
Example: associatedPr.lastCommit.tree.file(name: currentFileName)
Yes but you would have the same issue if more than 100 files were changed For example #2925
Not just the files that the PR touches.
👆
Yep, possible:
{
repository(owner: "sindresorhus", name: "refined-github") {
# New
file: object(expression: "1bd2494431d9ddc26ad27f9c32b1c8d711f3b263:source/options.html") {
... on Blob {
id
}
}
# Same as before
commit: object(expression: "1bd2494431d9ddc26ad27f9c32b1c8d711f3b263") {
... on Commit {
associatedPullRequests(last: 1) {
nodes {
number
mergeCommit {
oid
}
commits(last: 1) {
nodes {
commit {
oid
}
}
}
}
}
}
}
}
}
In this case file: null because the file didn't exist on that commit
Ok will send a PR in a few