fix: repo home page 500 due to the timeout of "get last commit info" (#38678)

Regression of the ctx removal from "git.Repository" struct (the old code
was already wrong and can still cause 500, the "ctx removal" just makes
the problem easier to reproduce).

Merge duplicate code.

Reviewd by codex: no actionable findings.
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-07-28 19:12:53 +08:00
1 parent a75ed103f4
commit 0ab3d569b4
8 files changed
+113 -200

No files matched your search

+1 -2
View File
@@ -105,8 +105,7 @@ func testGetCommitsInfo(t *testing.T, repo1 *Repository) {
continue
}
// FIXME: Context.TODO() - if graceful has started we should use its Shutdown context otherwise use install signals in TestMain.
commitsInfo, treeCommit, err := entries.GetCommitsInfo(t.Context(), "/any/repo-link", repo1, commit, testCase.Path)
commitsInfo, treeCommit, err := entries.GetCommitsInfo(t.Context(), time.Second, "/any/repo-link", repo1, commit, testCase.Path)
assert.NoError(t, err, "Unable to get commit information for entries of subtree: %s in commit: %s from testcase due to error: %v", testCase.Path, testCase.CommitID, err)
if err != nil {
t.FailNow()