Skip to content

Commit 7c0b5cb

Browse files
committed
improve
1 parent a85f099 commit 7c0b5cb

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

modules/git/command.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,11 @@ func AllowLFSFiltersArgs() TrustedCmdArgs {
472472
// see: https://github.com/go-gitea/gitea/issues/32889#issuecomment-2571848216
473473
// Should not add sapce in the end, sometimes git will add a `:`.
474474
func IsRemoteNotExistError(err error) bool {
475+
// for git < 2.30
475476
prefix := "exit status 128 - fatal: No such remote"
476-
if DefaultFeatures().NewExitStatusForRemoteNotExist {
477+
478+
// for git >= 2.30
479+
if DefaultFeatures().CheckVersionAtLeast("2.30") {
477480
prefix = "exit status 2 - error: No such remote"
478481
}
479482
return strings.HasPrefix(err.Error(), prefix)

modules/git/git.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ const RequiredVersion = "2.0.0" // the minimum Git version required
2626
type Features struct {
2727
gitVersion *version.Version
2828

29-
UsingGogit bool
30-
SupportProcReceive bool // >= 2.29
31-
SupportHashSha256 bool // >= 2.42, SHA-256 repositories no longer an ‘experimental curiosity’
32-
SupportedObjectFormats []ObjectFormat // sha1, sha256
33-
NewExitStatusForRemoteNotExist bool // >= 2.30
29+
UsingGogit bool
30+
SupportProcReceive bool // >= 2.29
31+
SupportHashSha256 bool // >= 2.42, SHA-256 repositories no longer an ‘experimental curiosity’
32+
SupportedObjectFormats []ObjectFormat // sha1, sha256
3433
}
3534

3635
var (
@@ -78,7 +77,6 @@ func loadGitVersionFeatures() (*Features, error) {
7877
if features.SupportHashSha256 {
7978
features.SupportedObjectFormats = append(features.SupportedObjectFormats, Sha256ObjectFormat)
8079
}
81-
features.NewExitStatusForRemoteNotExist = features.CheckVersionAtLeast("2.30")
8280
return features, nil
8381
}
8482

0 commit comments

Comments
 (0)