Skip to content

Commit

Permalink
clean up local copy
Browse files Browse the repository at this point in the history
  • Loading branch information
kelloggm committed Mar 13, 2024
1 parent 3910005 commit dca3bd4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -409,4 +413,4 @@ def main():


if __name__ == "__main__":
main()
main()

0 comments on commit dca3bd4

Please sign in to comment.