Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit629fd87

Browse files
committed
Fix how version_info omits non-numeric fields
For#1833.This makes version_info parsing stop including fields after thefirst non-numeric field, rather than skipping non-numeric fieldsand including subsequent numeric fields that then wrongly appear tohave the original position and significance of the dropped field.This actually stops at (rather than merely after) a non-numericfield, i.e., potentially parseable fields that are not fullynumeric, such as "2a", are stopped at, rather than parsed as "2".
1 parentac20325 commit629fd87

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎git/cmd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
importre
99
importcontextlib
1010
importio
11+
importitertools
1112
importlogging
1213
importos
1314
importsignal
@@ -850,7 +851,8 @@ def version_info(self) -> Tuple[int, ...]:
850851
process_version=self._call_process("version")
851852
version_string=process_version.split(" ")[2]
852853
version_fields=version_string.split(".")[:4]
853-
self._version_info=tuple(int(n)forninversion_fieldsifn.isdigit())
854+
leading_numeric_fields=itertools.takewhile(str.isdigit,version_fields)
855+
self._version_info=tuple(map(int,leading_numeric_fields))
854856

855857
# This value will be considered valid until the next refresh.
856858
self._version_info_token=refresh_token

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp