4049292152
Right now, we have a function which can trim the relative path prefix, but that is only available in the `commands` package. In the future, we'll want to use it elsewhere as well, so let's move it somewhere more accessible.
18 lines
275 B
Go
18 lines
275 B
Go
package commands
|
|
|
|
import "strings"
|
|
|
|
func gitLineEnding(git env) string {
|
|
value, _ := git.Get("core.autocrlf")
|
|
switch strings.ToLower(value) {
|
|
case "true", "t", "1":
|
|
return "\r\n"
|
|
default:
|
|
return osLineEnding()
|
|
}
|
|
}
|
|
|
|
type env interface {
|
|
Get(string) (string, bool)
|
|
}
|