MCPcopy Create free account
hub / github.com/BillHuang2001/evogit / create_git_dir

Function create_git_dir

python-impl/evogit/utils/git.py:31–48  ·  view source on GitHub ↗
(git_dir, force_create=False)

Source from the content-addressed store, hash-verified

29
30
31def create_git_dir(git_dir, force_create=False) -> None:
32 if os.path.exists(git_dir):
33 print(f"{git_dir} already exists! Do you want to remove it? (y/n)")
34 if force_create or input() == "y":
35 print(f"Removing {git_dir}...")
36 for filename in os.listdir(git_dir):
37 file_path = os.path.join(git_dir, filename)
38 if os.path.isfile(file_path):
39 os.remove(file_path)
40 elif os.path.isdir(file_path):
41 shutil.rmtree(file_path)
42 else:
43 raise ValueError(f"Unknown file type: {file_path}")
44 else:
45 print("Abort!")
46 exit()
47 else:
48 os.mkdir(git_dir, mode=0o755)
49
50
51def delete_remote_branches(config: EvoGitConfig) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected