Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify comments; add assertion (helps mypy)
  • Loading branch information
EliahKagan committed Feb 22, 2024
commit 82b0a1e0681a662d5d418277292cf73fd26cae92
6 changes: 4 additions & 2 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,11 @@ def version_info(self) -> Tuple[int, int, int, int]:

This value is generated on demand and is cached.
"""
refresh_token = self._refresh_token # Copy it, in case of a concurrent refresh.
# Use a copy of this global state, in case of a concurrent refresh.
refresh_token = self._refresh_token

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

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

@overload
Expand Down