Skip to content

Git timeout regression test cannot reach diff-tree after single-commit validation #5130

Description

@Widthdom

Summary

GitHelperTests.GetChangedFilesFromCommit_FailsWhenGitCommandTimesOut consistently fails on current origin/main under net8.0. The fake git used by the test returns a fixed hash for rev-parse --verify, while ValidateSingleCommitRef now requires the resolved hash to match the requested temporary commit. Validation therefore throws ArgumentException before the fake diff-tree process can exercise the intended timeout path.

Reproduction

dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release -f net8.0 --filter FullyQualifiedName~GetChangedFilesFromCommit_FailsWhenGitCommandTimesOut --no-build --no-restore

Expected: the test reaches diff-tree and observes the bounded timeout as InvalidOperationException.

Actual: Invalid commit ID ... Git could not resolve it to a single commit is raised as ArgumentException.

Acceptance criteria

  • The fake git validation response remains consistent with the temporary commit passed by the test.
  • The test reaches the diff-tree timeout path and verifies that the child process is reaped.
  • Production single-commit validation remains strict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions