run(f'"{git}" -C "{dir}" fetch',f"Fetching updates for {name}...",f"Couldn't fetch {name}")
run(f'"{git}" -C "{dir}" checkout {commithash}',f"Checking out commit for {name} with hash: {commithash}...",f"Couldn't checkout commit {commithash} for {name}",live=True)
try:
run(f'"{git}" -C "{dir}" checkout {commithash}',f"Checking out commit for {name} with hash: {commithash}...",f"Couldn't checkout commit {commithash} for {name}",live=True)
exceptRuntimeError:
print(f"Unable to checkout {name} with hash {commithash}, attempting autofix...")
git_fix_workspace(dir,name)
run(f'"{git}" -C "{dir}" checkout {commithash}',f"Checking out commit for {name} with hash: {commithash}...",f"Couldn't checkout commit {commithash} for {name}",live=True)
return
run(f'"{git}" clone "{url}" "{dir}"',f"Cloning {name} into {dir}...",f"Couldn't clone {name}",live=True)