ref: 02645cbbc0704cd5e0fdb3b48be0c02eb5e3ab01
dir: /receivepack/version.go/
package receivepack
import (
"strings"
common "codeberg.org/lindenii/furgit/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
}