Skip to content

Commit ff22b4f

Browse files
committed
Revert "pygit2: workaround for codespaces system config"
This reverts commit d175b92.
1 parent 0d798b4 commit ff22b4f

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/scmrepo/git/backend/pygit2.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Union,
1616
)
1717

18-
from funcy import cached_property, first
18+
from funcy import cached_property
1919

2020
from scmrepo.exceptions import CloneError, MergeConflictError, RevError, SCMError
2121
from scmrepo.utils import relpath
@@ -27,8 +27,6 @@
2727

2828

2929
if TYPE_CHECKING:
30-
from pygit2 import Signature
31-
3230
from scmrepo.progress import GitProgressEvent
3331

3432

@@ -120,30 +118,12 @@ def _resolve_refish(self, refish: str):
120118
return commit, ref
121119

122120
@property
123-
def default_signature(self) -> "Signature":
121+
def default_signature(self):
124122
try:
125123
return self.repo.default_signature
126124
except KeyError as exc:
127-
signature = self._get_codespaces_signature()
128-
if signature is not None:
129-
return signature
130125
raise SCMError("Git username and email must be configured") from exc
131126

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-
147127
@staticmethod
148128
def _get_checkout_strategy(strategy: Optional[int] = None):
149129
from pygit2 import (

0 commit comments

Comments
 (0)