Returns True if the hash exists in the repo
(hash: str)
| 65 | |
| 66 | |
| 67 | def does_commit_exist(hash: str) -> bool: |
| 68 | """ |
| 69 | Returns True if the hash exists in the repo |
| 70 | """ |
| 71 | sh = Sh() |
| 72 | cmd = f"git rev-parse -q {hash}" |
| 73 | proc = sh.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False) |
| 74 | print(proc.stdout) |
| 75 | if proc.returncode == 0: |
| 76 | return True |
| 77 | |
| 78 | if "unknown revision or path not in the working tree" in proc.stdout: |
| 79 | return False |
| 80 | |
| 81 | raise RuntimeError(f"Unexpected failure when running: {cmd}") |
| 82 | |
| 83 | |
| 84 | def find_hash_for_tag(tag: dict[str, Any]) -> str: |
no test coverage detected
searching dependent graphs…