Skip to content

Commit 87a7c37

Browse files
author
Gusted
authored
Use strings.Cut for GIT_PROTOCOL value (#20638)
- As per #20616 (comment)
1 parent 90b2657 commit 87a7c37

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

modules/ssh/ssh.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ func sessionHandler(session ssh.Session) {
7878
gitProtocol := ""
7979
for _, env := range session.Environ() {
8080
if strings.HasPrefix(env, "GIT_PROTOCOL=") {
81-
// The value would be version=2, so using normal split doesn't work here.
82-
gitProtocol = strings.SplitN(env, "=", 2)[1]
81+
_, gitProtocol, _ = strings.Cut(env, "=")
8382
break
8483
}
8584
}

0 commit comments

Comments
 (0)