mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-18 15:00:00 -05:00
fix: handle applied rev not existing in diff
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user