Skip to content

revparse no-ops when it shouldn't. #155

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

Closed
adamhooper opened this issue Jun 25, 2014 · 3 comments
Closed

revparse no-ops when it shouldn't. #155

adamhooper opened this issue Jun 25, 2014 · 3 comments
Milestone

Comments

@adamhooper
Copy link
Contributor

Line 100 of lib.rb, according to https://github.com/schacon/ruby-git/blob/5ff106ae7ed3ad3bbc757f8961104de2fb2c5e78/lib/git/lib.rb#L101

    return string if string =~ /[A-Fa-f0-9]{40}/  # passing in a sha - just no-op it

But my poor string is 357b586115a9590a164f547ec539c6f5274fbc12^{commit}. So that's what comes back at me.

The regex should start with \A and end with \Z.

@robertodecurnex
Copy link
Contributor

Good catch! Anything CONTAINING a SHA-like substring will be returned untouched.

In fact, 40-hex names are permitted (really bad practice, but they may exist).

git itself will warn you if you use a 40-hex name so let's keep that return, for the sake of backwards compatibility.

Working on it.

@robertodecurnex robertodecurnex added this to the 1.2.8 milestone Jun 25, 2014
@adamhooper
Copy link
Contributor Author

Wow. That was fast :)

@robertodecurnex
Copy link
Contributor

You've done the hard work here :p

I've just changed \A \Z for ^ $ since it's a little more clear and mean the same on the given scenario.

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

No branches or pull requests

2 participants