fix: handle applied rev not existing in diff

This commit is contained in:
2 * r + 2 * t
2026-06-17 20:20:50 +10:00
parent 7def47d120
commit 222023f6d5
2 changed files with 24 additions and 9 deletions
+9
View File
@@ -68,6 +68,15 @@ class DotsSource:
out = self._git("diff", "--name-only", base, head)
return [line for line in out.splitlines() if line]
def has_rev(self, rev: str) -> bool:
"""Whether `rev` resolves to a commit."""
try:
self._git("rev-parse", "--verify", "--quiet", f"{rev}^{{commit}}")
return True
except SourceError:
return False
def clean(self) -> None:
"""Remove all untracked files in the git repo."""
self._git("clean", "-fdx")