Update old "ref" references to "rev" in git.detached state

Fixes #42381

The "rev" kwarg was added to replace "ref" in #38898, however,
when switching the state over to "rev", some stacktraces occur
due to some remaining "ref" references.
This commit is contained in:
rallytime 2017-07-19 13:29:42 -06:00
parent d385dfd19d
commit d9d94fe02f

View file

@ -2213,7 +2213,7 @@ def detached(name,
# Determine if supplied ref is a hash
remote_rev_type = 'ref'
if len(ref) <= 40 \
if len(rev) <= 40 \
and all(x in string.hexdigits for x in rev):
rev = rev.lower()
remote_rev_type = 'hash'
@ -2419,7 +2419,7 @@ def detached(name,
https_pass=https_pass,
ignore_retcode=False)
if 'refs/remotes/'+remote+'/'+ref in all_remote_refs:
if 'refs/remotes/'+remote+'/'+rev in all_remote_refs:
checkout_commit_id = all_remote_refs['refs/remotes/' + remote + '/' + rev]
elif 'refs/tags/' + rev in all_remote_refs:
checkout_commit_id = all_remote_refs['refs/tags/' + rev]