New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support timestamps in parseRoute
#3137
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCurrentBranch can be skipped altogether in that case
@fregante I didn't parse (pun intended) what you are saying. |
There are many more formats supported by @: https://linux.die.net/man/1/git-rev-parse What’s the issue in this case specifically? |
The Maybe just let it error out? Or update the features not to run? |
Neither. The problem is that the URL doesn't match the meta tag ( |
const branch = getCurrentBranch(); | ||
next[0] = isTimeStamp(next[0]) ? branch + '/' : next[0]; | ||
const parts = next.join('/'); | ||
if (parts !== branch && !parts.startsWith(branch + '/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
if (parts !== branch && !parts.startsWith(branch + '/')) { | |
if (parts !== branch && !parts.startsWith(branch + '/') &&!isTimeStamp(next[0])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will only work if there is no file name.
https://github.com/sindresorhus/eslint-plugin-unicorn/tree/HEAD@%7B2020-05-24T16:33:08Z%7D
But the following will not
https://github.com/sindresorhus/refined-github/blob/master@%7B2019-04-20T03:27:17Z%7D/license
https://github.com/sindresorhus/refined-github/blob/master@%7B2019-12-11T10:12:11Z%7D/source/features/comments-time-machine-links.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just this
if (parts !== branch && !parts.startsWith(branch + '/')) { | |
// Exclude extended revisions from being tested #3137 https://git-scm.com/docs/git-rev-parse#_specifying_revisions | |
if (parts !== branch && !parts.startsWith(branch + '/') && !/\^|~|@{/.test(next[0])) { |
More test URLs: https://github.com/sindresorhus/refined-github/blob/master@%7B1500%7D/package.json Really there are a lot more situations where this might not work: https://github.com/yakov116/refined-github/blob/master%5E/package.json |
100% correct |
Wait I'll rewrite this function to be less strict |
Thanks. ❤️ |
See #3135 (comment)
Test URL's
https://github.com/sindresorhus/refined-github/blob/master@%7B2019-04-20T03:27:17Z%7D/license
https://github.com/sindresorhus/refined-github/blob/master@%7B2019-12-11T10:12:11Z%7D/source/features/comments-time-machine-links.tsx
https://github.com/sindresorhus/eslint-plugin-unicorn/tree/HEAD@%7B2020-05-24T16:33:08Z%7D
@fregante I dont have much time. (I did this very quickly)