[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2026-01-10 Thread Brian Harring
commit: c49575826b8193e31b7b4b00c9fd703c3f2db10a
Author: Brian Harring  gmail  com>
AuthorDate: Sat Jan 10 10:03:49 2026 +
Commit: Brian Harring  gmail  com>
CommitDate: Sat Jan 10 10:03:49 2026 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=c4957582

clarify allowed keyword rules

https://projects.gentoo.org/pms/9/pms.html#keyword-names documents
what's allowed, but #767 showed we should improve the inline code
comments to be clearer.

Signed-off-by: Brian Harring  gmail.com>

 src/pkgcheck/addons/__init__.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/pkgcheck/addons/__init__.py b/src/pkgcheck/addons/__init__.py
index c621c53b..6cdc0a89 100644
--- a/src/pkgcheck/addons/__init__.py
+++ b/src/pkgcheck/addons/__init__.py
@@ -88,6 +88,10 @@ class KeywordsAddon(base.Addon):
 
 def __init__(self, *args):
 super().__init__(*args)
+# see https://projects.gentoo.org/pms/9/pms.html#keyword-names .
+# usage of '-' indicates that the named arch is never to be considered 
as a target
+# for stabilization. `-*` is shorthand to state that any arch not 
explicitly marked
+# as stable or unstable, is not to be considered for stabilization.
 special = {"-*"}
 self.arches: frozenset[str] = self.options.target_repo.known_arches
 unstable = {"~" + x for x in self.arches}



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2025-05-02 Thread Arthur Zamarin
commit: b471c5cb82debe479b2021d7adfffe9e228ac896
Author: Arthur Zamarin  gentoo  org>
AuthorDate: Fri May  2 09:52:35 2025 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Fri May  2 10:03:31 2025 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=b471c5cb

caches: support compression of cache files

profiles.pickle has become quite fat on disk, getting to 185MB in size.
More information on the source of issue can be found in the issue linked
below, but I've decided to use "zstd -T0" (with default compression level)
to compress the cache files. This should help with the size of the
cache files, and the performance hit should be negligible.

I've measured the time it takes to load the cache files before and after
this change, and the difference is nil. The time is mostly the cost of
pickle.load, and the compression/decompression is negligible in comparison.

I'm still somewhat concerned about my usage of subprocess.Popen, but I
think it's fine.

Resolves: https://github.com/pkgcore/pkgcheck/issues/735
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/caches.py   | 30 --
 src/pkgcheck/addons/profiles.py |  2 +-
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/pkgcheck/addons/caches.py b/src/pkgcheck/addons/caches.py
index 9cd13e58..a6c94b73 100644
--- a/src/pkgcheck/addons/caches.py
+++ b/src/pkgcheck/addons/caches.py
@@ -5,6 +5,7 @@ import os
 import pathlib
 import pickle
 import shutil
+import subprocess
 from collections import UserDict
 from dataclasses import dataclass
 from hashlib import blake2b
@@ -79,11 +80,21 @@ class CachedAddon(Addon):
 dirname = f"{repo.repo_id.lstrip(os.sep)}-{token}"
 return pjoin(self.options.cache_dir, "repos", dirname, self.cache.file)
 
-def load_cache(self, path, fallback=None):
+def load_cache(self, path: str, fallback=None):
 cache = fallback
 try:
-with open(path, "rb") as f:
-cache = pickle.load(f)
+if path.endswith(".zst"):
+if not os.path.exists(path):
+raise FileNotFoundError(path)
+with subprocess.Popen(("zstd", "-qdcf", path), 
stdout=subprocess.PIPE) as proc:
+if proc.poll():
+raise PkgcheckUserException(
+f"failed decompressing {self.cache.type} cache: 
{path!r}"
+)
+cache = pickle.load(proc.stdout)
+else:
+with open(path, "rb") as f:
+cache = pickle.load(f)
 if cache.version != self.cache.version:
 logger.debug("forcing %s cache regen due to outdated version", 
self.cache.type)
 os.remove(path)
@@ -98,11 +109,18 @@ class CachedAddon(Addon):
 cache = fallback
 return cache
 
-def save_cache(self, data, path):
+def save_cache(self, data, path: str):
 try:
 os.makedirs(os.path.dirname(path), exist_ok=True)
-with AtomicWriteFile(path, binary=True) as f:
-pickle.dump(data, f, protocol=-1)
+if path.endswith(".zst"):
+with subprocess.Popen(("zstd", "-T0", "-fqo", path), 
stdin=subprocess.PIPE) as proc:
+pickle.dump(data, proc.stdin, protocol=-1)
+if os.path.exists(path[:-4]):
+logger.warning("removing old %s cache file", 
self.cache.type)
+os.remove(path[:-4])
+else:
+with AtomicWriteFile(path, binary=True) as f:
+pickle.dump(data, f, protocol=-1)
 except IOError as e:
 msg = f"failed dumping {self.cache.type} cache: {path!r}: 
{e.strerror}"
 raise PkgcheckUserException(msg)

diff --git a/src/pkgcheck/addons/profiles.py b/src/pkgcheck/addons/profiles.py
index f9a6862e..ec4e8e8e 100644
--- a/src/pkgcheck/addons/profiles.py
+++ b/src/pkgcheck/addons/profiles.py
@@ -119,7 +119,7 @@ class ProfileAddon(caches.CachedAddon):
 non_profile_dirs = frozenset(["desc", "updates"])
 
 # cache registry
-cache = caches.CacheData(type="profiles", file="profiles.pickle", 
version=2)
+cache = caches.CacheData(type="profiles", file="profiles.pickle.zst", 
version=3)
 
 @classmethod
 def mangle_argparser(cls, parser):



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2025-02-07 Thread Arthur Zamarin
commit: 9e52de6f3e238d832b86b5abe196e6e3439ce2bd
Author: Martin Mokry  users  noreply  github 
 com>
AuthorDate: Tue Feb  4 10:09:40 2025 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Fri Feb  7 19:26:26 2025 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=9e52de6f

git: suggest clearing cache on `git log` error

In some cases, the cache gets corrupted, showing:

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

Recommend clearing the cache with `pkgcheck cache -R` as a workaround.

Signed-off-by: Martin Mokry  protonmail.com>
Closes: https://github.com/pkgcore/pkgcheck/pull/729
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/git.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/pkgcheck/addons/git.py b/src/pkgcheck/addons/git.py
index 1874e8a6..e3de52c0 100644
--- a/src/pkgcheck/addons/git.py
+++ b/src/pkgcheck/addons/git.py
@@ -126,7 +126,12 @@ class GitLog:
 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()
 



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2024-03-01 Thread Arthur Zamarin
commit: 796cffb5634d50747c73fe989a3de77031aebea0
Author: Sam James  gentoo  org>
AuthorDate: Fri Feb 16 23:25:33 2024 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Fri Mar  1 19:19:14 2024 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=796cffb5

git: fix no-copies option

This reverts commit 9103513e26f9f2aeade5b563a49697c0e2665e3e.

I originally added --no-find-copies in e688357bdc5773009bb2e106075d9852f2513f89
to suppress git being too clever which ends up confusing our git integration, as
we're not really interested in copies. I was going to use 
--no-find-copies-harder
but I figured --no-find-copies sounded better as it was less specific and for
our purposes here, we don't want copies at all, so why not?

But --no-find-copies isn't a boolean option, it's just that until git commit
5825268db1058516d05be03d6a8d8d55eea5a943 ('parse-options: fully disable option 
abbreviation with PARSE_OPT_KEEP_UNKNOWN'),
it tolerated it and expanded it to --no-find-copies-harder. Oops!

Let's use --no-find-copies-harder as we originally should have, as the only
available option to control the behavior, modulo setting a similarity % 
threshold
with --find-copies=n.

We're fine to do this as, quoting the git-log docs:
"[...] and options applicable to the git-diff[1] command to control how the 
changes each commit introduces are shown."

Bug: https://bugs.gentoo.org/924718
Bug: https://github.com/pkgcore/pkgcheck/issues/663
Signed-off-by: Sam James  gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/664
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/git.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/pkgcheck/addons/git.py b/src/pkgcheck/addons/git.py
index 752c9cff..7b2435ac 100644
--- a/src/pkgcheck/addons/git.py
+++ b/src/pkgcheck/addons/git.py
@@ -155,8 +155,7 @@ class _ParseGitRepo:
 cmd = shlex.split(self._git_cmd)
 cmd.append(f"--pretty=tformat:%n{'%n'.join(self._format)}")
 cmd.append(commit_range)
-# https://bugs.gentoo.org/924718
-# cmd.extend(("--no-find-copies", "--no-find-copies-harder", 
"--find-renames"))
+cmd.extend(("--no-find-copies-harder", "--find-renames"))
 
 self.git_log = GitLog(cmd, self.path)
 # discard the initial newline



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2024-02-16 Thread Arthur Zamarin
commit: 9103513e26f9f2aeade5b563a49697c0e2665e3e
Author: Arthur Zamarin  gentoo  org>
AuthorDate: Fri Feb 16 20:38:46 2024 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Fri Feb 16 20:38:46 2024 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=9103513e

git: revert log no copies option

It broke with git-2.43.2, until further upstream work by Sam James, I'll
just revert it.

Bug: https://bugs.gentoo.org/924718
Reverts: e688357bdc5773009bb2e106075d9852f2513f89
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/git.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pkgcheck/addons/git.py b/src/pkgcheck/addons/git.py
index 0db52091..752c9cff 100644
--- a/src/pkgcheck/addons/git.py
+++ b/src/pkgcheck/addons/git.py
@@ -155,7 +155,8 @@ class _ParseGitRepo:
 cmd = shlex.split(self._git_cmd)
 cmd.append(f"--pretty=tformat:%n{'%n'.join(self._format)}")
 cmd.append(commit_range)
-cmd.extend(("--no-find-copies", "--no-find-copies-harder", 
"--find-renames"))
+# https://bugs.gentoo.org/924718
+# cmd.extend(("--no-find-copies", "--no-find-copies-harder", 
"--find-renames"))
 
 self.git_log = GitLog(cmd, self.path)
 # discard the initial newline



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2024-02-09 Thread Arthur Zamarin
commit: 043cbef7cd6c6fa2ca73fbcdf6769ea21cfb5950
Author: Anna “CyberTailor”  sysrq  in>
AuthorDate: Thu Feb  1 16:53:50 2024 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Fri Feb  9 17:55:12 2024 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=043cbef7

addons.net: suppress urllib3 import warnings

Most notably, this includes NotOpenSSLWarning:
https://github.com/urllib3/urllib3/issues/3020#issuecomment-1785873825

Signed-off-by: Anna “CyberTailor”  sysrq.in>
Closes: https://github.com/pkgcore/pkgcheck/pull/661
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/net.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/pkgcheck/addons/net.py b/src/pkgcheck/addons/net.py
index 6db5432d..782d74d1 100644
--- a/src/pkgcheck/addons/net.py
+++ b/src/pkgcheck/addons/net.py
@@ -2,12 +2,14 @@
 
 import logging
 import os
-
-import requests
+import warnings
 
 from ..checks.network import RequestError, SSLError
 
-# suppress all urllib3 log messages
+# suppress all urllib3 log messages and import warnings
+with warnings.catch_warnings():
+warnings.simplefilter("ignore")
+import requests
 logging.getLogger("urllib3").propagate = False
 
 



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2023-10-03 Thread Arthur Zamarin
commit: a19030fda246d49a3ff24f44a0f005e99dd65a1a
Author: Arthur Zamarin  gentoo  org>
AuthorDate: Tue Oct  3 18:25:27 2023 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Tue Oct  3 18:25:27 2023 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=a19030fd

addons.git: add helping message on failure on git remote setup

Upon initial failure to get the git diff-tree output (so not the hot
flow, but sad failure flow), try to catch output of incorrectly
configured git remote (the remote should have a correct HEAD configured).

Recommend the user to run `git remote set-head origin -a` to solve it.

Resolves: https://github.com/pkgcore/pkgcheck/issues/608
Resolves: https://github.com/pkgcore/pkgdev/issues/107
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/git.py | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/src/pkgcheck/addons/git.py b/src/pkgcheck/addons/git.py
index 5d41ba3b..0db52091 100644
--- a/src/pkgcheck/addons/git.py
+++ b/src/pkgcheck/addons/git.py
@@ -353,6 +353,26 @@ class _ScanGit(argparse.Action):
 def default_ref(self, remote):
 return "HEAD" if self.staged else f"{remote}..HEAD"
 
+def _try_git_remote(self, parser, namespace):
+"""Try to catch case of missing git remote HEAD ref."""
+try:
+subprocess.run(
+["git", "rev-parse", namespace.git_remote],
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE,
+cwd=namespace.target_repo.location,
+check=True,
+encoding="utf8",
+)
+except FileNotFoundError as exc:
+parser.error(str(exc))
+except subprocess.CalledProcessError as exc:
+error = exc.stderr.splitlines()[0]
+if "ambiguous argument" in error and "unknown revision" in error:
+parser.error(
+f"failed running git: {error}\nSuggested to configure the 
remote by running 'git remote set-head {namespace.git_remote} -a'"
+)
+
 def generate_restrictions(self, parser, namespace, ref):
 """Generate restrictions for a given diff command."""
 try:
@@ -368,6 +388,8 @@ class _ScanGit(argparse.Action):
 parser.error(str(exc))
 except subprocess.CalledProcessError as exc:
 error = exc.stderr.splitlines()[0]
+if "ambiguous argument" in error and "unknown revision" in error:
+self._try_git_remote(parser, namespace)
 parser.error(f"failed running git: {error}")
 
 if not p.stdout:



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2023-09-08 Thread Arthur Zamarin
commit: e688357bdc5773009bb2e106075d9852f2513f89
Author: Sam James  gentoo  org>
AuthorDate: Thu Sep  7 22:54:44 2023 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Fri Sep  8 12:20:25 2023 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=e688357b

addons: git: pass --no-find-copies --no-find-copies-harder --find-renames to 
git log

I currently have a local git hack to allow configuring git to default to
--find-copies-harder because it's *extremely* useful when working on ebuild
repositories (prompted by a discussion with Eli Schwartz).

Unfortunately, this can confuse pkgcheck's git intergration because it'll
call `git log` like:
```
git log --name-status --diff-filter=ARMD -z --pretty=tformat:%n%h%n%ct 
cc5b3b9f134a070c548faa4e3de17d615497d0b3..origin/HEAD
```
and get nothing back because (I think) git is interpreting some changes as 
copies
rather than renames or new files.

Explicitly pass options to disable finding copies, even though normally this
isn't necessary, to keep things working.

Signed-off-by: Sam James  gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/618
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/git.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pkgcheck/addons/git.py b/src/pkgcheck/addons/git.py
index 669ac262..5d41ba3b 100644
--- a/src/pkgcheck/addons/git.py
+++ b/src/pkgcheck/addons/git.py
@@ -155,6 +155,7 @@ class _ParseGitRepo:
 cmd = shlex.split(self._git_cmd)
 cmd.append(f"--pretty=tformat:%n{'%n'.join(self._format)}")
 cmd.append(commit_range)
+cmd.extend(("--no-find-copies", "--no-find-copies-harder", 
"--find-renames"))
 
 self.git_log = GitLog(cmd, self.path)
 # discard the initial newline



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2023-01-24 Thread Arthur Zamarin
commit: 4d74d90aa601b5caab445a9dd88c649c0b02856f
Author: Arthur Zamarin  gentoo  org>
AuthorDate: Tue Jan 24 19:21:25 2023 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Tue Jan 24 19:21:25 2023 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=4d74d90a

_GitCommitPkg: fix no attribute live or slot

Resolves: https://github.com/pkgcore/pkgcheck/issues/380
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/git.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/pkgcheck/addons/git.py b/src/pkgcheck/addons/git.py
index 9fd016ce..2547bcc5 100644
--- a/src/pkgcheck/addons/git.py
+++ b/src/pkgcheck/addons/git.py
@@ -264,6 +264,12 @@ class GitRepoPkgs(_ParseGitRepo):
 class _GitCommitPkg(cpv.VersionedCPV):
 """Fake packages encapsulating commits parsed from git log."""
 
+__slots__ = ("commit", "old", "status", "time")
+
+# set multiple defaults for the fake package
+live = False
+slot = "0"
+
 def __init__(self, category, package, status, version, time, commit, 
old=None):
 super().__init__(category, package, version)
 



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/

2023-01-19 Thread Arthur Zamarin
commit: 0e22d6f56b735b5b7449e5e3f800685bb54651d4
Author: Daniel M. Weeks  danweeks  net>
AuthorDate: Thu Jan 19 17:12:06 2023 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Thu Jan 19 20:54:28 2023 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=0e22d6f5

Use REPO profile base for profile caching

Prior to this change, scanning an overlay would always cause a profile
cache update since nothing repo-specific was actually getting updated.

Signed-off-by: Daniel M. Weeks  danweeks.net>
Closes: https://github.com/pkgcore/pkgcheck/pull/528
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/profiles.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/pkgcheck/addons/profiles.py b/src/pkgcheck/addons/profiles.py
index 799cd94a..f9a6862e 100644
--- a/src/pkgcheck/addons/profiles.py
+++ b/src/pkgcheck/addons/profiles.py
@@ -267,7 +267,9 @@ class ProfileAddon(caches.CachedAddon):
 for profile_obj, profile in self.arch_profiles.get(arch, 
[]):
 files = self.profile_data.get(profile)
 try:
-cached_profile = 
cached_profiles[profile.base][profile.path]
+cached_profile = 
cached_profiles[repo.config.profiles_base][
+profile.path
+]
 if files != cached_profile["files"]:
 # force refresh of outdated cache entry
 raise KeyError
@@ -329,8 +331,8 @@ class ProfileAddon(caches.CachedAddon):
 # unsupported EAPI or other issue, profile 
checks will catch this
 continue
 
-cached_profiles[profile.base]["update"] = True
-cached_profiles[profile.base][profile.path] = {
+
cached_profiles[repo.config.profiles_base]["update"] = True
+
cached_profiles[repo.config.profiles_base][profile.path] = {
 "files": files,
 "masks": masks,
 "unmasks": unmasks,



[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/addons/, tests/checks/

2023-01-09 Thread Arthur Zamarin
commit: 3c01e94cebda01041319903c8f5da382fcc96142
Author: Arthur Zamarin  gentoo  org>
AuthorDate: Mon Jan  9 17:23:19 2023 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Mon Jan  9 18:01:51 2023 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=3c01e94c

git checks: include revision for old name during rename op

Previously it was including only the version without a revision, which
was failing and crashing the git check. This fixes it by including the
revision using the "fullver" property.

Include a reproducer test which fails without this commit and passes
with it.

Reported-by: Sam James  gentoo.org>
Reported-by: David Seifert  gentoo.org>
Resolves: https://github.com/pkgcore/pkgcheck/issues/511
Signed-off-by: Arthur Zamarin  gentoo.org>

 src/pkgcheck/addons/git.py |  2 +-
 tests/checks/test_git.py   | 29 +
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/pkgcheck/addons/git.py b/src/pkgcheck/addons/git.py
index 26c1d06d..9fd016ce 100644
--- a/src/pkgcheck/addons/git.py
+++ b/src/pkgcheck/addons/git.py
@@ -280,7 +280,7 @@ class _GitCommitPkg(cpv.VersionedCPV):
 self.old.category,
 self.old.package,
 self.status,
-self.old.version,
+self.old.fullver,
 self.time,
 self.commit,
 )

diff --git a/tests/checks/test_git.py b/tests/checks/test_git.py
index 1cefd549..0294f0b3 100644
--- a/tests/checks/test_git.py
+++ b/tests/checks/test_git.py
@@ -621,6 +621,35 @@ class TestGitPkgCommitsCheck(ReportTestCase):
 self.init_check()
 self.assertNoReport(self.check, self.source)
 
+def test_revision_move(self):
+self.parent_git_repo.move(
+"cat/pkg/pkg-0.ebuild",
+"cat/pkg/pkg-0-r1.ebuild",
+msg="cat/pkg: some random fixes",
+)
+self.parent_repo.create_ebuild("cat/newpkg-0-r1", keywords=["~amd64"])
+self.parent_git_repo.add_all("cat/newpkg: new package, v0")
+
+self.child_git_repo.run(["git", "pull", "origin", "main"])
+self.child_git_repo.run(["git", "remote", "set-head", "origin", 
"main"])
+
+# moving revision version won't crash check
+self.child_git_repo.move(
+"cat/pkg/pkg-0-r1.ebuild",
+"cat/pkg/pkg-0-r2.ebuild",
+msg="cat/pkg: some extra random fixes",
+signoff=True,
+)
+self.child_git_repo.move(
+"cat/newpkg/newpkg-0-r1.ebuild",
+"cat/newpkg/newpkg-0-r2.ebuild",
+msg="cat/newpkg: some random fixes",
+signoff=True,
+)
+
+self.init_check()
+self.assertNoReport(self.check, self.source)
+
 
 class TestGitEclassCommitsCheck(ReportTestCase):