Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion git_sizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message matching uses an exact prefix match which may be fragile across different git versions or locales. Consider using strings.Contains to match a key part of the error (e.g., "unknown option" and "object-format") for more robust detection, or document the git version assumptions if this exact format is intentional.

Suggested change
if err != nil && strings.HasPrefix(string(output), "error: unknown option `object-format'") {
t.Skip("skipping due to lack of SHA256 support")
if err != nil {
msg := string(output)
if strings.Contains(msg, "unknown option") && strings.Contains(msg, "object-format") {
t.Skip("skipping due to lack of SHA256 support")
}

Copilot uses AI. Check for mistakes.
}
require.NoError(t, err)
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the git init command fails for a reason other than missing SHA256 support, the error message at line 875 won't include the command output, making it harder to diagnose the failure. Consider adding the output to the error message, for example by using require.NoError(t, err, \"git init failed: %s\", string(output)) or a similar approach that includes the output in failure cases.

Suggested change
require.NoError(t, err)
require.NoError(t, err, "git init failed: %s", string(output))

Copilot uses AI. Check for mistakes.

timestamp := time.Unix(1112911993, 0)
Expand Down
Loading