Loading tests/unit/gitlab_ci/pre_commit_run/tests.py +20 −0 Original line number Diff line number Diff line Loading @@ -191,3 +191,23 @@ class PreCommitRunTests(unittest.TestCase): expect = ["run", "more", "arguments", "--all-files"] self.assertListEqual(expect, args) def test_comparison_branch_is_ancestor(self) -> None: """ Check find_lca works when the branch to assess against is a direct ancestor Regression test for an issue where an error was reported when calling: git fetch <repo> --shallow-exclude=<ancestor> <current-branch> Depending on transport the error was: ssh or file: "fatal: no commits selected for shallow requests" http: "fatal: error processing shallow info: 4" """ args, env = self.run_script( MAIN, CI_MERGE_REQUEST_TARGET_BRANCH_NAME=LCA, ) lca = self.branches[LCA] expect = ["run", f"--from-ref={lca.head}", f"--to-ref={env['CI_COMMIT_SHA']}"] self.assertListEqual(expect, args) Loading
tests/unit/gitlab_ci/pre_commit_run/tests.py +20 −0 Original line number Diff line number Diff line Loading @@ -191,3 +191,23 @@ class PreCommitRunTests(unittest.TestCase): expect = ["run", "more", "arguments", "--all-files"] self.assertListEqual(expect, args) def test_comparison_branch_is_ancestor(self) -> None: """ Check find_lca works when the branch to assess against is a direct ancestor Regression test for an issue where an error was reported when calling: git fetch <repo> --shallow-exclude=<ancestor> <current-branch> Depending on transport the error was: ssh or file: "fatal: no commits selected for shallow requests" http: "fatal: error processing shallow info: 4" """ args, env = self.run_script( MAIN, CI_MERGE_REQUEST_TARGET_BRANCH_NAME=LCA, ) lca = self.branches[LCA] expect = ["run", f"--from-ref={lca.head}", f"--to-ref={env['CI_COMMIT_SHA']}"] self.assertListEqual(expect, args)