Skip to content

Commit 82b0a1e

Browse files
committed
Clarify comments; add assertion (helps mypy)
1 parent 24b065e commit 82b0a1e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: git/cmd.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -838,10 +838,11 @@ def version_info(self) -> Tuple[int, int, int, int]:
838838
839839
This value is generated on demand and is cached.
840840
"""
841-
refresh_token = self._refresh_token # Copy it, in case of a concurrent refresh.
841+
# Use a copy of this global state, in case of a concurrent refresh.
842+
refresh_token = self._refresh_token
842843

843844
# Ask git for its version if we haven't done so since the last refresh.
844-
# (Refreshing is global, but version information caching is per-instance.)
845+
# (Refreshing is global, but version_info caching is per-instance.)
845846
if self._version_info_token is not refresh_token:
846847
# We only use the first 4 numbers, as everything else could be strings in fact (on Windows).
847848
process_version = self._call_process("version") # Should be as default *args and **kwargs used.
@@ -853,6 +854,7 @@ def version_info(self) -> Tuple[int, int, int, int]:
853854
)
854855
self._version_info_token = refresh_token
855856

857+
assert self._version_info is not None, "Bug: token check should never let None through"
856858
return self._version_info
857859

858860
@overload

0 commit comments

Comments
 (0)