Skip to content

Commit

Permalink
git: suggest clearing cache on git log error
Browse files Browse the repository at this point in the history
In some cases, the cache gets corrupted, showing:

pkgcheck scan: error: failed running git log: fatal: Invalid revision range <hash>..origin/HEAD

Recommend clearing the cache w/ `pkgcheck cache -R` as a workaround.
Signed-off-by: Martin Mokry <martin-kokos@protonmail.com>
  • Loading branch information
martin-kokos committed Feb 4, 2025
1 parent e5ebcdc commit 15312f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pkgcheck/addons/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ def __next__(self):
if not self._running:
if self.proc.poll() or not line:
error = self.proc.stderr.read().decode().strip()
raise GitError(f"failed running git log: {error}")
if 'Invalid revision range' in error:
raise GitError(f"failed running git log: {error}\nTry clearing the cache: pkgcheck cache -R")
else:
raise GitError(f"failed running git log: {error}")
self._running = True
self.git_config.close()

Expand Down

0 comments on commit 15312f2

Please sign in to comment.