From dca3bd4f3507562850cffae83f55703e1ce11d39 Mon Sep 17 00:00:00 2001 From: Martin Kellogg Date: Wed, 13 Mar 2024 17:16:50 -0400 Subject: [PATCH] clean up local copy --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d926a0d..5506212 100644 --- a/main.py +++ b/main.py @@ -142,6 +142,10 @@ def clone_repository(url, directory): project_name = get_repository_name(url) if (os.path.exists(os.path.join(directory, project_name))): print(f"{project_name} repository already exists. Aborting cloning") + # make sure the existing repo is clean + project_dir=str(os.path.join(directory, project_name)) + subprocess.run(["git", "reset", "--hard"], cwd=project_dir) + subprocess.run(["git", "clean", "-f", "-d", "-x"], cwd=project_dir) return subprocess.run(["git", "clone", url], cwd=directory) @@ -409,4 +413,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()