Skip to content

Commit

Permalink
Use strings.Cut for GIT_PROTOCOL value (#20638)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusted authored Aug 2, 2022
1 parent 90b2657 commit 87a7c37
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ func sessionHandler(session ssh.Session) {
gitProtocol := ""
for _, env := range session.Environ() {
if strings.HasPrefix(env, "GIT_PROTOCOL=") {
// The value would be version=2, so using normal split doesn't work here.
gitProtocol = strings.SplitN(env, "=", 2)[1]
_, gitProtocol, _ = strings.Cut(env, "=")
break
}
}
Expand Down

0 comments on commit 87a7c37

Please sign in to comment.