Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

Copy link
Member

@fregante fregante left a 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

@yakov116
Copy link
Member Author

@fregante I didn't parse (pun intended) what you are saying.

@fregante
Copy link
Member

There are many more formats supported by @: https://linux.die.net/man/1/git-rev-parse

What’s the issue in this case specifically?

@yakov116
Copy link
Member Author

yakov116 commented May 25, 2020

The default-branch-buttonand latest tag will both fail on a time link.

Maybe just let it error out? Or update the features not to run?

@fregante
Copy link
Member

Neither. The problem is that the URL doesn't match the meta tag (getCurrentBranch) so the solution is to just skip this check and assume that the pathname passed matches the page.

const branch = getCurrentBranch();
next[0] = isTimeStamp(next[0]) ? branch + '/' : next[0];
const parts = next.join('/');
if (parts !== branch && !parts.startsWith(branch + '/')) {
Copy link
Member

@fregante fregante May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

Suggested change
if (parts !== branch && !parts.startsWith(branch + '/')) {
if (parts !== branch && !parts.startsWith(branch + '/') &&!isTimeStamp(next[0])) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just this

Suggested change
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])) {

@yakov116
Copy link
Member Author

100% correct

@fregante fregante self-assigned this May 25, 2020
@fregante
Copy link
Member

Wait I'll rewrite this function to be less strict

@fregante fregante closed this May 25, 2020
@yakov116
Copy link
Member Author

Thanks. ❤️

@yakov116 yakov116 deleted the support_timestamps branch May 25, 2020 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants