github.com/2lambda123/git-lfs@v2.5.2+incompatible/commands/path.go (about) 1 package commands 2 3 import "strings" 4 5 func gitLineEnding(git env) string { 6 value, _ := git.Get("core.autocrlf") 7 switch strings.ToLower(value) { 8 case "input", "true", "t", "1": 9 return "\r\n" 10 default: 11 return osLineEnding() 12 } 13 } 14 15 const ( 16 windowsPrefix = `.\` 17 nixPrefix = `./` 18 ) 19 20 // trimCurrentPrefix removes a leading prefix of "./" or ".\" (referring to the 21 // current directory in a platform independent manner). 22 // 23 // It is useful for callers such as "git lfs track" and "git lfs untrack", that 24 // wish to compare filepaths and/or attributes patterns without cleaning across 25 // multiple platforms. 26 func trimCurrentPrefix(p string) string { 27 if strings.HasPrefix(p, windowsPrefix) { 28 return strings.TrimPrefix(p, windowsPrefix) 29 } 30 return strings.TrimPrefix(p, nixPrefix) 31 } 32 33 type env interface { 34 Get(string) (string, bool) 35 }