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

fix(util): Allow git tag and branch name with hash #4881

Closed
wants to merge 1 commit into from

Conversation

torifat
Copy link
Member

@torifat torifat commented Nov 8, 2017

Summary

In Git # is a valid character for tag and branch

git check-ref-format "tags/v1.1.2-#279-require-twice-protection" && echo "Valid tag" || echo "Invalid tag"

Fixes #4880

@arcanis
Copy link
Member

arcanis commented Nov 9, 2017

I'm a bit concerned by the ambiguity this change would add, which could cause issues in other parts of our stack that make the assumption that there can only be a single # character in a reference string. I'd personally be in favor of not supporting this syntax.

@torifat
Copy link
Member Author

torifat commented Nov 9, 2017

I agree. We can keep the old function as it is and handle multiple # inside git resolver. What do you think?

@kscc25
Copy link

kscc25 commented Nov 15, 2017

@arcanis I don't agree, if yarn is supposed to support git tag, it must support all forms of valid tag.

@torifat
Copy link
Member Author

torifat commented Nov 17, 2017

I agree. We can keep the old function as it is and handle multiple # inside git resolver. What do you think?

@arcanis ☝️

@arcanis
Copy link
Member

arcanis commented Jan 15, 2018

Sorry @torifat, I missed your comment! Problem with that is that it breaks a very common assumption about URLs, so I'm not sure it would work :/

Is it common to have hashes inside a branch name? I understand the "it's valid git" argument, but it's quite inconvenient nevertheless.

@BYK
Copy link
Member

BYK commented Apr 26, 2018

I think any legit # in the tag name should be URL encoded. Does that scenario work right now?

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

Agree with @arcanis here. I'm okay if we decode the part after the # sign.

@rally25rs
Copy link
Contributor

I opened #5960 before realizing that this PR existed. I'll close mine since it's basically the same as this one.

My opinion is that unless we can prove that this does break something elsewhere in yarn, I don't see a reason to not support it. I don't think the branch/tag is used in a URL so I don't think it would need URL encoded. It's just passed through git commands or used when comparing the output of git refs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yarn fails to resolve git tag which contains # character
5 participants