|
15 | 15 | Union, |
16 | 16 | ) |
17 | 17 |
|
18 | | -from funcy import cached_property, first |
| 18 | +from funcy import cached_property |
19 | 19 |
|
20 | 20 | from scmrepo.exceptions import CloneError, MergeConflictError, RevError, SCMError |
21 | 21 | from scmrepo.utils import relpath |
|
27 | 27 |
|
28 | 28 |
|
29 | 29 | if TYPE_CHECKING: |
30 | | - from pygit2 import Signature |
31 | | - |
32 | 30 | from scmrepo.progress import GitProgressEvent |
33 | 31 |
|
34 | 32 |
|
@@ -120,30 +118,12 @@ def _resolve_refish(self, refish: str): |
120 | 118 | return commit, ref |
121 | 119 |
|
122 | 120 | @property |
123 | | - def default_signature(self) -> "Signature": |
| 121 | + def default_signature(self): |
124 | 122 | try: |
125 | 123 | return self.repo.default_signature |
126 | 124 | except KeyError as exc: |
127 | | - signature = self._get_codespaces_signature() |
128 | | - if signature is not None: |
129 | | - return signature |
130 | 125 | raise SCMError("Git username and email must be configured") from exc |
131 | 126 |
|
132 | | - def _get_codespaces_signature(self) -> Optional["Signature"]: |
133 | | - from pygit2 import Config, Signature |
134 | | - |
135 | | - if "CODESPACES" not in os.environ: |
136 | | - return None |
137 | | - try: |
138 | | - config = Config("/usr/local/etc/gitconfig") |
139 | | - name = first(config.get_multivar("user.name")) |
140 | | - email = first(config.get_multivar("user.email")) |
141 | | - if name and email: |
142 | | - return Signature(name, email) |
143 | | - except Exception: # nosec B110, pylint: disable=broad-except |
144 | | - pass |
145 | | - return None |
146 | | - |
147 | 127 | @staticmethod |
148 | 128 | def _get_checkout_strategy(strategy: Optional[int] = None): |
149 | 129 | from pygit2 import ( |
|
0 commit comments