commit: 3c01e94cebda01041319903c8f5da382fcc96142 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Mon Jan 9 17:23:19 2023 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Mon Jan 9 18:01:51 2023 +0000 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 <sam <AT> gentoo.org> Reported-by: David Seifert <soap <AT> gentoo.org> Resolves: https://github.com/pkgcore/pkgcheck/issues/511 Signed-off-by: Arthur Zamarin <arthurzam <AT> 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):