Skip to content

Commit 089b9c2

Browse files
committed
move to "remote.go"
1 parent 7c09850 commit 089b9c2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

modules/git/command.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,3 @@ func AllowLFSFiltersArgs() TrustedCmdArgs {
467467
}
468468
return filteredLFSGlobalArgs[:j]
469469
}
470-
471-
// IsRemoteNotExistError returns the prefix of the error message when a remote does not exist.
472-
// see: https://github.com/go-gitea/gitea/issues/32889#issuecomment-2571848216
473-
// Should not add sapce in the end, sometimes git will add a `:`.
474-
func IsRemoteNotExistError(err error) bool {
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)
478-
}

modules/git/remote.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ func (err *ErrInvalidCloneAddr) Unwrap() error {
7979
return util.ErrInvalidArgument
8080
}
8181

82+
// IsRemoteNotExistError returns the prefix of the error message when a remote does not exist.
83+
// see: https://github.com/go-gitea/gitea/issues/32889#issuecomment-2571848216
84+
// Should not add sapce in the end, sometimes git will add a `:`.
85+
func IsRemoteNotExistError(err error) bool {
86+
prefix1 := "exit status 128 - fatal: No such remote" // git < 2.30
87+
prefix2 := "exit status 2 - error: No such remote" // git >= 2.30
88+
return strings.HasPrefix(err.Error(), prefix1) || strings.HasPrefix(err.Error(), prefix2)
89+
}
90+
8291
// ParseRemoteAddr checks if given remote address is valid,
8392
// and returns composed URL with needed username and password.
8493
func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, error) {

0 commit comments

Comments
 (0)