|
9 | 9 |
|
10 | 10 | import logging |
11 | 11 | import re |
12 | | - |
13 | | -from git.cmd import Git, handle_process_output |
14 | | -from git.compat import force_text |
15 | | -from git.config import GitConfigParser, SectionConstraint, cp |
16 | | -from git.refs import Reference, RemoteReference, SymbolicReference, TagReference |
17 | | -from git.util import ( |
18 | | - CallableRemoteProgress, |
19 | | - IterableList, |
20 | | - IterableObj, |
21 | | - LazyMixin, |
22 | | - RemoteProgress, |
23 | | -) |
| 12 | +import warnings |
24 | 13 |
|
25 | 14 | # typing------------------------------------------------------- |
26 | | - |
27 | 15 | from typing import ( |
| 16 | + TYPE_CHECKING, |
28 | 17 | Any, |
29 | 18 | Callable, |
30 | 19 | Dict, |
|
33 | 22 | NoReturn, |
34 | 23 | Optional, |
35 | 24 | Sequence, |
36 | | - TYPE_CHECKING, |
37 | 25 | TypeVar, |
38 | 26 | Union, |
39 | 27 | cast, |
40 | 28 | overload, |
41 | 29 | ) |
42 | 30 |
|
| 31 | +from git.cmd import Git, handle_process_output |
| 32 | +from git.compat import force_text |
| 33 | +from git.config import GitConfigParser, SectionConstraint, cp |
| 34 | +from git.refs import Reference, RemoteReference, SymbolicReference, TagReference |
43 | 35 | from git.types import AnyGitObject, Literal, PathLike |
| 36 | +from git.util import ( |
| 37 | + CallableRemoteProgress, |
| 38 | + IterableList, |
| 39 | + IterableObj, |
| 40 | + LazyMixin, |
| 41 | + RemoteProgress, |
| 42 | +) |
44 | 43 |
|
45 | 44 | if TYPE_CHECKING: |
46 | 45 | from git.objects.commit import Commit |
@@ -323,19 +322,17 @@ class FetchInfo(IterableObj): |
323 | 322 | "*": 0, |
324 | 323 | "=": HEAD_UPTODATE, |
325 | 324 | " ": FAST_FORWARD, |
326 | | - "-": TAG_UPDATE, |
| 325 | + "t": TAG_UPDATE, |
327 | 326 | } |
328 | 327 |
|
329 | 328 | @classmethod |
330 | 329 | def refresh(cls) -> Literal[True]: |
331 | | - """Update information about which :manpage:`git-fetch(1)` flags are supported |
332 | | - by the git executable being used. |
| 330 | + """Deprecated and no longer needed. |
333 | 331 |
|
334 | | - Called by the :func:`git.refresh` function in the top level ``__init__``. |
| 332 | + Git has used ``t`` for fetch tag updates since Git 2.10. GitPython |
| 333 | + requires Git 2.52 or newer, so no version-specific mapping is needed. |
335 | 334 | """ |
336 | | - cls._flag_map["t"] = cls.TAG_UPDATE |
337 | | - cls._flag_map["-"] = 0 |
338 | | - |
| 335 | + warnings.warn("FetchInfo.refresh() is deprecated and no longer needed", DeprecationWarning, stacklevel=2) |
339 | 336 | return True |
340 | 337 |
|
341 | 338 | def __init__( |
@@ -814,6 +811,9 @@ def _get_fetch_info_from_stderr( |
814 | 811 | in_submodule = True |
815 | 812 | if in_submodule: |
816 | 813 | continue |
| 814 | + # --prune lists each ref it deleted; there is no ref left to report. |
| 815 | + if line[3:].startswith("[deleted]"): |
| 816 | + continue |
817 | 817 | for cmd in cmds: |
818 | 818 | if len(line) > 1 and line[0] == " " and line[1] == cmd: |
819 | 819 | fetch_info_lines.append(line) |
|
0 commit comments