Skip to content

Commit

Permalink
Merge pull request #23 from tahiat/clean
Browse files Browse the repository at this point in the history
Clean up local copy
  • Loading branch information
tahiat authored Mar 13, 2024
2 parents 3910005 + dca3bd4 commit ac94e1d
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 ac94e1d

Please sign in to comment.