summaryrefslogtreecommitdiffstats
path: root/modules/indexer
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-03-11 05:30:36 +0800
committerGitHub <noreply@github.com>2024-03-10 22:30:36 +0100
commit3c6fc25a77c37d50686caa495d27a31dcef7f75f (patch)
treebaee1d20d877cdfcf6c65e6784068ea86c85e17b /modules/indexer
parent851bd18234ff3de4c603c57c3b380eb5495d8eb7 (diff)
downloadgitea-3c6fc25a77c37d50686caa495d27a31dcef7f75f.tar.gz
gitea-3c6fc25a77c37d50686caa495d27a31dcef7f75f.zip
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.
Diffstat (limited to 'modules/indexer')
-rw-r--r--modules/indexer/code/git.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/modules/indexer/code/git.go b/modules/indexer/code/git.go
index 76cd78e11e..f105d032eb 100644
--- a/modules/indexer/code/git.go
+++ b/modules/indexer/code/git.go
@@ -91,11 +91,9 @@ func genesisChanges(ctx context.Context, repo *repo_model.Repository, revision s
return nil, runErr
}
+ objectFormat := git.ObjectFormatFromName(repo.ObjectFormatName)
+
var err error
- objectFormat, err := git.GetObjectFormatOfRepo(ctx, repo.RepoPath())
- if err != nil {
- return nil, err
- }
changes.Updates, err = parseGitLsTreeOutput(objectFormat, stdout)
return &changes, err
}
@@ -174,10 +172,8 @@ func nonGenesisChanges(ctx context.Context, repo *repo_model.Repository, revisio
return nil, err
}
- objectFormat, err := git.GetObjectFormatOfRepo(ctx, repo.RepoPath())
- if err != nil {
- return nil, err
- }
+ objectFormat := git.ObjectFormatFromName(repo.ObjectFormatName)
+
changes.Updates, err = parseGitLsTreeOutput(objectFormat, lsTreeStdout)
return &changes, err
}