Skip to content

Commit 98eddbd

Browse files
author
Codeflash Bot
committed
revert the username to defaults again...
Signed-off-by: Codeflash Bot <[email protected]>
1 parent 0643de3 commit 98eddbd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

codeflash/code_utils/git_worktree_utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,25 @@
1818

1919
def create_worktree_snapshot_commit(worktree_dir: Path, commit_message: str) -> None:
2020
repository = git.Repo(worktree_dir, search_parent_directories=True)
21+
username = None
22+
email = None
23+
with repository.config_reader() as cr:
24+
username = cr.remove_option("user", "name")
25+
email = cr.remove_option("user", "email")
26+
repository.git.config()
27+
with repository.config_writer() as cw:
28+
if not cw.has_option("user", "name"):
29+
cw.set_value("user", "name", "Codeflash Bot")
30+
if not cw.has_option("user", "email"):
31+
cw.set_value("user", "email", "[email protected]")
2132

2233
repository.git.add(".")
2334
repository.git.commit("-m", commit_message, "--no-verify")
35+
with repository.config_writer() as cw:
36+
if username:
37+
cw.set_value("user", "name", username)
38+
if email:
39+
cw.set_value("user", "email", email)
2440

2541

2642
def create_detached_worktree(module_root: Path) -> Optional[Path]:

0 commit comments

Comments
 (0)