aboutsummaryrefslogtreecommitdiff
path: root/diff/trees/path.go
blob: 0ced379a65df80b55a008439d5bc14dcf7e7ae9a (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package trees

func joinPath(prefix, name []byte) []byte {
	if len(prefix) == 0 {
		out := make([]byte, len(name))
		copy(out, name)
		return out
	}
	out := make([]byte, len(prefix)+1+len(name))
	copy(out, prefix)
	out[len(prefix)] = '/'
	copy(out[len(prefix)+1:], name)
	return out
}