blob: 2bd42535914d1f0a9b188786dcc3c530971254b6 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package files
import (
"fmt"
"strings"
)
type refPath struct {
root rootKind
path string
}
func updateTargetKey(name refPath) string {
return fmt.Sprintf("%d:%s", name.root, name.path)
}
func refPathFromKey(key string) refPath {
rootValue, pathValue, ok := strings.Cut(key, ":")
if !ok || rootValue == "" {
return refPath{root: rootCommon, path: key}
}
if rootValue == "0" {
return refPath{root: rootGit, path: pathValue}
}
return refPath{root: rootCommon, path: pathValue}
}
|