diff --git a/src/cli/main/cli.py b/src/cli/main/cli.py index e2d9e817..1698bbf1 100644 --- a/src/cli/main/cli.py +++ b/src/cli/main/cli.py @@ -120,13 +120,11 @@ def _clone_src(src: str) -> str: if abspath(src) == CWD: # `m .` ? if NIX_STABLE: - _add_safe_directory() _clone_src_git_worktree_add(src, head) else: # Nix with Flakes already ensures a pristine git repo head = src else: - _add_safe_directory() if ( (match := _clone_src_github(src)) or (match := _clone_src_gitlab(src)) @@ -149,20 +147,6 @@ def _clone_src(src: str) -> str: return head -def _add_safe_directory() -> None: - cmd = [ - "git", - "config", - "--global", - "--add", - "safe.directory", - "/github/workspace", - ] - out = _run(cmd, stderr=None, stdout=sys.stderr.fileno()) - if out != 0: - raise SystemExit(out) - - def _clone_src_git_init(head: str) -> None: cmd = ["git", "init", "--initial-branch=____", "--shared=false", head] out = _run(cmd, stderr=None, stdout=sys.stderr.fileno()) @@ -413,23 +397,9 @@ class Config(NamedTuple): def _get_named_temporary_file_name() -> str: - attempts = 0 file_name = "" - success = False - while attempts < 5 and not success: - try: - with tempfile.NamedTemporaryFile(delete=True) as file: - file_name = file.name - success = True - except FileExistsError as error: - CON.print( - f"Failed to create {error.filename}, retrying in 1 second..." - ) - attempts += 1 - sleep(1) - - if not success: - raise FileExistsError("Could not create file after 5 attempts.") + with tempfile.NamedTemporaryFile(delete=True) as file: + file_name = file.name return file_name