| 43 | |
| 44 | |
| 45 | def _ensure_git_config(repo: Repo) -> None: |
| 46 | config = repo.config_reader() |
| 47 | |
| 48 | try: |
| 49 | config.get_value("user", "name") |
| 50 | except (NoSectionError, NoOptionError): |
| 51 | # user.name not configured, set a default at repo level |
| 52 | with repo.config_writer(config_level="repository") as writer: |
| 53 | writer.set_value("user", "name", "Codeplain") |
| 54 | |
| 55 | try: |
| 56 | config.get_value("user", "email") |
| 57 | except (NoSectionError, NoOptionError): |
| 58 | # user.email not configured, set a default at repo level |
| 59 | with repo.config_writer(config_level="repository") as writer: |
| 60 | writer.set_value("user", "email", "codeplain@localhost") |
| 61 | |
| 62 | |
| 63 | def init_git_repo( |