From b8f51b14f28a9fe09f30fb41d140a093c20d7160 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 03 Apr 2025 16:07:41 +0800 Subject: [PATCH] Rename commitDisplay to commitDisplayOld --- cache_index_commits_display.go | 4 ++-- git_misc.go | 10 +++++----- http_handle_repo_index.go | 2 +- diff --git a/cache_index_commits_display.go b/cache_index_commits_display.go index fc28cf11441c4002e990fcdd3a4f7a90d5cd4c01..54b3eab782a4344e91163b8056ca772ea32ffc4a 100644 --- a/cache_index_commits_display.go +++ b/cache_index_commits_display.go @@ -9,11 +9,11 @@ "go.lindenii.runxiyu.org/lindenii-common/clog" ) // The key is the commit ID raw hash. -var indexCommitsDisplayCache *ristretto.Cache[[]byte, []commitDisplay] +var indexCommitsDisplayCache *ristretto.Cache[[]byte, []commitDisplayOld] func init() { var err error - indexCommitsDisplayCache, err = ristretto.NewCache(&ristretto.Config[[]byte, []commitDisplay]{ + indexCommitsDisplayCache, err = ristretto.NewCache(&ristretto.Config[[]byte, []commitDisplayOld]{ NumCounters: 1e4, MaxCost: 1 << 60, BufferItems: 8192, diff --git a/git_misc.go b/git_misc.go index 3ff6f81ab228d88a5a84ec0116f4be42524cd48a..4714e1ae7113a77d2e92fb17db4c9b1942717ea7 100644 --- a/git_misc.go +++ b/git_misc.go @@ -165,7 +165,7 @@ // getRecentCommitsDisplay generates a slice of [commitDisplay] friendly for // use in HTML templates, consisting of numCommits commits from headhash in the // repo. -func getRecentCommitsDisplay(repo *git.Repository, headHash plumbing.Hash, numCommits int) (recentCommits []commitDisplay, err error) { +func getRecentCommitsDisplay(repo *git.Repository, headHash plumbing.Hash, numCommits int) (recentCommits []commitDisplayOld, err error) { var commitIter object.CommitIter var thisCommit *object.Commit @@ -173,7 +173,7 @@ commitIter, err = repo.Log(&git.LogOptions{From: headHash}) //exhaustruct:ignore if err != nil { return nil, err } - recentCommits = make([]commitDisplay, 0) + recentCommits = make([]commitDisplayOld, 0) defer commitIter.Close() if numCommits < 0 { for { @@ -183,7 +183,7 @@ return recentCommits, nil } else if err != nil { return nil, err } - recentCommits = append(recentCommits, commitDisplay{ + recentCommits = append(recentCommits, commitDisplayOld{ thisCommit.Hash, thisCommit.Author, thisCommit.Committer, @@ -199,7 +199,7 @@ return recentCommits, nil } else if err != nil { return nil, err } - recentCommits = append(recentCommits, commitDisplay{ + recentCommits = append(recentCommits, commitDisplayOld{ thisCommit.Hash, thisCommit.Author, thisCommit.Committer, @@ -211,7 +211,7 @@ } return recentCommits, err } -type commitDisplay struct { +type commitDisplayOld struct { Hash plumbing.Hash Author object.Signature Committer object.Signature diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index 9dc3ea6f60fc093e8598fbfba07f6e3200232e58..6852fe70d26637382a4e6ca726126201837c6ac9 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -27,7 +27,7 @@ var tree *object.Tree var notes []string var branches []string var branchesIter storer.ReferenceIter - var commits []commitDisplay + var commits []commitDisplayOld repo, repoName, groupPath = params["repo"].(*git.Repository), params["repo_name"].(string), params["group_path"].([]string) -- 2.48.1