Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@IagoAbal
Copy link
Contributor

@IagoAbal IagoAbal commented May 4, 2018

The previous test len(rev) == 40 does not allow for short SHAs, and
would incorrectly identify a 40-char branch or tag name as a SHA.
A better trade-off is to require rev to be a sequence of hexadecimal
digits in order to be recognized as a SHA, while allowing SHAs shorter
than 40 digits.

gitman/git.py Outdated
commit SHA. The minimum of 7 digits is not an arbitrary choice, it
is the default length for short SHAs in Git.
"""
re.match('^[0-9a-f]{7,40}$', rev) is not None
Copy link
Owner

Choose a reason for hiding this comment

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

You need a return statement here. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing it out. Too bad that Pylint did not warn me about that one. I mostly code in programming languages where no return statement is needed... so it's easy for me to forget!

Copy link
Owner

Choose a reason for hiding this comment

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

pylint should catch that, but there was some sort of issue installing dependencies on Travis CI. Please rebase on develop.

Copy link
Contributor Author

@IagoAbal IagoAbal May 4, 2018

Choose a reason for hiding this comment

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

OK, it is probably because my Pylint is for Python 2 and this project uses Python 3. I have rebased, let's see now.

@IagoAbal IagoAbal force-pushed the develop branch 2 times, most recently from 374416e to daf0b39 Compare May 4, 2018 20:24
The previous test `len(rev) == 40` does not allow for short SHAs, and
would incorrectly identify a 40-char branch or tag name as a SHA.
A better trade-off is to require `rev` to be a sequence of hexadecimal
digits in order to be recognized as a SHA, while allowing SHAs shorter
than 40 digits.
@jacebrowning
Copy link
Owner

Thanks for the PR!

Closes #166

@jacebrowning jacebrowning merged commit aaf505a into jacebrowning:develop May 4, 2018
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.

2 participants