MCPcopy Create free account
hub / github.com/antonmedv/gitmal / trimTreePrefix

Function trimTreePrefix

pkg/gitdiff/file_header.go:505–513  ·  view source on GitHub ↗

trimTreePrefix removes up to n leading directory components from name.

(name string, n int)

Source from the content-addressed store, hash-verified

503
504// trimTreePrefix removes up to n leading directory components from name.
505func trimTreePrefix(name string, n int) string {
506 i := 0
507 for ; i < len(name) && n > 0; i++ {
508 if name[i] == '/' {
509 n--
510 }
511 }
512 return name[i:]
513}
514
515// hasEpochTimestamp returns true if the string ends with a POSIX-formatted
516// timestamp for the UNIX epoch after a tab character. According to git, this

Callers 1

parseGitHeaderNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected