separate fetch and update check

This commit is contained in:
ltdrdata
2023-05-30 23:16:31 +09:00
parent 40e7ddb4f1
commit 28f3fac5f7
3 changed files with 97 additions and 15 deletions

View File

@@ -11,12 +11,14 @@ def gitclone(custom_nodes_path, url):
repo.git.clear_cache()
repo.close()
def gitcheck(path):
def gitcheck(path, do_fetch=False):
# Fetch the latest commits from the remote repository
repo = git.Repo(path)
remote_name = 'origin'
remote = repo.remote(name=remote_name)
remote.fetch()
if do_fetch:
remote.fetch()
# Get the current commit hash and the commit hash of the remote branch
commit_hash = repo.head.commit.hexsha
@@ -50,7 +52,9 @@ try:
if sys.argv[1] == "--clone":
gitclone(sys.argv[2], sys.argv[3])
elif sys.argv[1] == "--check":
gitcheck(sys.argv[2])
gitcheck(sys.argv[2], False)
elif sys.argv[1] == "--fetch":
gitcheck(sys.argv[2], True)
elif sys.argv[1] == "--pull":
gitpull(sys.argv[2])
exit(0)