Skip to content

Commit 7c09850

Browse files
yp05327wxiaoguang
andauthored
Update modules/git/command.go
Co-authored-by: wxiaoguang <[email protected]>
1 parent 7c0b5cb commit 7c09850

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

modules/git/command.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,7 @@ 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
476-
prefix := "exit status 128 - fatal: No such remote"
477-
478-
// for git >= 2.30
479-
if DefaultFeatures().CheckVersionAtLeast("2.30") {
480-
prefix = "exit status 2 - error: No such remote"
481-
}
482-
return strings.HasPrefix(err.Error(), prefix)
475+
prefix1 := "exit status 128 - fatal: No such remote" // git < 2.30
476+
prefix2 := "exit status 2 - error: No such remote" // git >= 2.30
477+
return strings.HasPrefix(err.Error(), prefix1) || strings.HasPrefix(err.Error(), prefix2)
483478
}

0 commit comments

Comments
 (0)