Skip to content

Commit

Permalink
Revert "dulwich: workaround for codespaces system config"
Browse files Browse the repository at this point in the history
This reverts commit 8b40388.
  • Loading branch information
pmrowla committed Jan 30, 2023
1 parent ff22b4f commit 4984eb3
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions src/scmrepo/git/backend/dulwich/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,32 +285,10 @@ def commit(self, msg: str, no_verify: bool = False):
try:
commit(self.root_dir, message=msg, no_verify=no_verify)
except InvalidUserIdentity as exc:
identity = self._get_codespaces_identity()
if identity is not None:
commit(
self.root_dir,
message=msg,
no_verify=no_verify,
committer=identity,
author=identity,
)
else:
raise SCMError("Git username and email must be configured") from exc
raise SCMError("Git username and email must be configured") from exc
except TimezoneFormatError as exc:
raise SCMError("Invalid Git timestamp") from exc

def _get_codespaces_identity(self) -> Optional[bytes]:
from dulwich.config import ConfigFile, StackedConfig
from dulwich.repo import get_user_identity

if "CODESPACES" not in os.environ:
return None
try:
config = StackedConfig([ConfigFile.from_path("/usr/local/etc/gitconfig")])
return get_user_identity(config)
except Exception: # pylint: disable=broad-except
return None

def checkout(
self,
branch: str,
Expand Down

0 comments on commit 4984eb3

Please sign in to comment.