@@ -448,25 +448,7 @@ def decygpath(path: PathLike) -> str:
|
448 | 448 | _is_cygwin_cache: Dict[str, Optional[bool]] = {} |
449 | 449 | |
450 | 450 | |
451 | | -@overload |
452 | | -def is_cygwin_git(git_executable: None) -> Literal[False]: |
453 | | - ... |
454 | | - |
455 | | - |
456 | | -@overload |
457 | | -def is_cygwin_git(git_executable: PathLike) -> bool: |
458 | | - ... |
459 | | - |
460 | | - |
461 | | -def is_cygwin_git(git_executable: Union[None, PathLike]) -> bool: |
462 | | -if sys.platform == "win32": |
463 | | -# This is Windows-native Python, since Cygwin has sys.platform == "cygwin". |
464 | | -return False |
465 | | - |
466 | | -if git_executable is None: |
467 | | -return False |
468 | | - |
469 | | -git_executable = str(git_executable) |
| 451 | +def _is_cygwin_git(git_executable: str) -> bool: |
470 | 452 | is_cygwin = _is_cygwin_cache.get(git_executable) # type: Optional[bool] |
471 | 453 | if is_cygwin is None: |
472 | 454 | is_cygwin = False |
@@ -489,6 +471,25 @@ def is_cygwin_git(git_executable: Union[None, PathLike]) -> bool:
|
489 | 471 | return is_cygwin |
490 | 472 | |
491 | 473 | |
| 474 | +@overload |
| 475 | +def is_cygwin_git(git_executable: None) -> Literal[False]: |
| 476 | + ... |
| 477 | + |
| 478 | + |
| 479 | +@overload |
| 480 | +def is_cygwin_git(git_executable: PathLike) -> bool: |
| 481 | + ... |
| 482 | + |
| 483 | + |
| 484 | +def is_cygwin_git(git_executable: Union[None, PathLike]) -> bool: |
| 485 | +if sys.platform == "win32": # TODO: See if we can use `sys.platform != "cygwin"`. |
| 486 | +return False |
| 487 | +elif git_executable is None: |
| 488 | +return False |
| 489 | +else: |
| 490 | +return _is_cygwin_git(str(git_executable)) |
| 491 | + |
| 492 | + |
492 | 493 | def get_user_id() -> str: |
493 | 494 | """:return: String identifying the currently active system user as ``name@node``""" |
494 | 495 | return "%s@%s" % (getpass.getuser(), platform.node()) |
|