Git.check_version() can return incorrect results #4675
Labels
auto-locked
Outdated issues that have been locked by automation
type: bug
A confirmed bug or unintended behavior
While working on PR #4674 for issue #4507, I noticed that the
Git
class'scheck_version()
method can return incorrect results, leading topip install -e git+git://...
not updating its clone in certain (albeit rare) cases when it needs to.Specifically,
Git.check_version(dest, rev_options)
isn't supposed to return True if given a branch or tag. For example, its docstring says:However, with the way it's currently written, the method can return True on a branch or tag since it does prefix matching instead of checking for an exact match. For example, given a repo with HEAD:
if you pass the tag name
10
, thencheck_version('/path', '10')
will return True even though10
isn't a commit hash. This can prevent pip from checking the remote repo for new tags / commits / etc.Related to this, I also noticed that
test_git_check_version()
has a bug because it is incorrectly passing a ref in each call tocheck_version()
instead of a list containing the ref.This means the following test case would incorrectly pass when it shouldn't (the other cases are "accidentally" working):
I posted a fix for both of these issues in PR #4674, which I'm going to break into smaller PR's. In that PR, I also simplified the API for
check_version()
to make it harder to use incorrectly, like in both of the cases above.The text was updated successfully, but these errors were encountered: