fix!: raise git required version to 2.13 (#37996)

format `lstrip=2` is only supported in git >= 2.13
https://git-scm.com/docs/git-for-each-ref/2.13.7

ref: #37994

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
wxiaoguang
2026-06-04 21:56:16 +08:00
committed by GitHub
parent aaf4b149fa
commit dac41a124f
5 changed files with 16 additions and 61 deletions
+1 -7
View File
@@ -15,13 +15,7 @@ import (
// GetRemoteAddress returns remote url of git repository in the repoPath with special remote name
func GetRemoteAddress(ctx context.Context, repoPath, remoteName string) (string, error) {
var cmd *gitcmd.Command
if DefaultFeatures().CheckVersionAtLeast("2.7") {
cmd = gitcmd.NewCommand("remote", "get-url").AddDynamicArguments(remoteName)
} else {
cmd = gitcmd.NewCommand("config", "--get").AddDynamicArguments("remote." + remoteName + ".url")
}
cmd := gitcmd.NewCommand("remote", "get-url").AddDynamicArguments(remoteName)
result, _, err := cmd.WithDir(repoPath).RunStdString(ctx)
if err != nil {
return "", err