ref: 3ce59c3248dec0eb0f918c42f37f53bc2ac20425
dir: /network/receivepack/version.go/
package receivepack
import (
"strings"
common "codeberg.org/lindenii/furgit/network/protocol/v0v1/server"
)
func parseVersion(gitProtocol string) common.Version {
if gitProtocol == "" {
return common.Version0
}
var highestRequested uint8
for field := range strings.SplitSeq(gitProtocol, ":") {
switch field {
case "version=0":
case "version=1":
if highestRequested < 1 {
highestRequested = 1
}
case "version=2":
if highestRequested < 2 {
highestRequested = 2
}
}
}
if highestRequested == 1 {
return common.Version1
}
return common.Version0
}