From b4fd2374e160f441225806a3d688d2777626355a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 13 Aug 2023 14:12:36 +0200 Subject: [PATCH] use git to cleanup worktree This is faster and less code than using python --- nixpkgs_review/builddir.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nixpkgs_review/builddir.py b/nixpkgs_review/builddir.py index 4bc9d505..1f2c393d 100644 --- a/nixpkgs_review/builddir.py +++ b/nixpkgs_review/builddir.py @@ -58,7 +58,6 @@ def __init__(self, name: str) -> None: self.worktree_dir = self.path.joinpath("nixpkgs") self.worktree_dir.mkdir() - self.worktree_dir = self.worktree_dir os.environ["NIX_PATH"] = self.nixpkgs_path() @@ -73,7 +72,6 @@ def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: os.environ.update(self.environ) with DisableKeyboardInterrupt(): - shutil.rmtree(self.worktree_dir) - sh(["git", "worktree", "prune"]) + sh(["git", "worktree", "remove", "-f", str(self.worktree_dir)]) self.overlay.cleanup()