From 3c6fc25a77c37d50686caa495d27a31dcef7f75f Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 11 Mar 2024 05:30:36 +0800 Subject: Use repo object format name instead of detecting from git repository (#29702) It's unnecessary to detect the repository object format from git repository. Just use the repository's object format name. --- services/mirror/mirror_pull.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'services/mirror/mirror_pull.go') diff --git a/services/mirror/mirror_pull.go b/services/mirror/mirror_pull.go index de4a58f27b..2a38d4ba55 100644 --- a/services/mirror/mirror_pull.go +++ b/services/mirror/mirror_pull.go @@ -479,10 +479,7 @@ func SyncPullMirror(ctx context.Context, repoID int64) bool { log.Error("SyncMirrors [repo: %-v]: unable to GetRefCommitID [ref_name: %s]: %v", m.Repo, result.refName, err) continue } - objectFormat, err := git.GetObjectFormatOfRepo(ctx, m.Repo.RepoPath()) - if err != nil { - log.Error("SyncMirrors [repo: %-v]: unable to GetHashTypeOfRepo: %v", m.Repo, err) - } + objectFormat := git.ObjectFormatFromName(m.Repo.ObjectFormatName) notify_service.SyncPushCommits(ctx, m.Repo.MustOwner(ctx), m.Repo, &repo_module.PushUpdateOptions{ RefFullName: result.refName, OldCommitID: objectFormat.EmptyObjectID().String(), -- cgit v1.2.3