From dba52c5e298c0d9966af9aa87969bde1dc481cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 16 Jan 2026 12:41:00 +0100 Subject: [PATCH 1/3] Skip the SHA256 test if git has not support for it If you are building and running the tests in an environment with an older version of git, it might not have SHA256 support. This should not cause the git-sizer test suite to fail as it's not an issue with git-sizer. Detect this situation and skip the test. --- git_sizer_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git_sizer_test.go b/git_sizer_test.go index c74b459..09f088f 100644 --- a/git_sizer_test.go +++ b/git_sizer_test.go @@ -867,7 +867,11 @@ func TestSHA256(t *testing.T) { // exist yet: cmd := exec.Command("git", "init", "--object-format", "sha256", testRepo.Path) cmd.Env = testutils.CleanGitEnv() - err = cmd.Run() + output, err := cmd.CombinedOutput() + + if err != nil && strings.HasPrefix(string(output), "error: unknown option `object-format'") { + t.Skip("skipping due to lack of SHA256 support") + } require.NoError(t, err) timestamp := time.Unix(1112911993, 0) From 0579f1812beaf09679e0651fbd0b36047759f5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 16 Jan 2026 12:48:24 +0100 Subject: [PATCH 2/3] ci: update the setup-go version Version 2 wants to use the old URL so that also fails to run. The latest is version 6 so let's update to that and at the same time update to the same Go version that we want to download in the build script. --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8efc5ea..542f410 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,9 +12,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v6 with: - go-version: '1.17' + go-version: '1.21.3' - name: Check out code uses: actions/checkout@v2 From 37ca70f5f033785298587bb642b83fce66616322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 16 Jan 2026 15:23:00 +0100 Subject: [PATCH 3/3] test: loosen the object-format error matching As pointed out by the robot, this can be an issue with different locales. It is enough for our purposes to know that the error message includes "object-format" so we know it's unhappy with it. --- git_sizer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_sizer_test.go b/git_sizer_test.go index 09f088f..f5c8006 100644 --- a/git_sizer_test.go +++ b/git_sizer_test.go @@ -869,7 +869,7 @@ func TestSHA256(t *testing.T) { cmd.Env = testutils.CleanGitEnv() output, err := cmd.CombinedOutput() - if err != nil && strings.HasPrefix(string(output), "error: unknown option `object-format'") { + if err != nil && strings.Contains(string(output), "object-format") { t.Skip("skipping due to lack of SHA256 support") } require.NoError(t, err)