move git dir env stuff into a centralised package

This commit is contained in:
Jesse Duffield
2020-09-27 16:17:26 +10:00
parent e873816160
commit 75598ea2a1
6 changed files with 49 additions and 19 deletions

24
pkg/env/env.go vendored Normal file
View File

@@ -0,0 +1,24 @@
package env
import "os"
func GetGitDirEnv() string {
return os.Getenv("GIT_DIR")
}
func GetGitWorkTreeEnv() string {
return os.Getenv("GIT_WORK_TREE")
}
func SetGitDirEnv(value string) {
os.Setenv("GIT_DIR", value)
}
func SetGitWorkTreeEnv(value string) {
os.Setenv("GIT_WORK_TREE", value)
}
func UnsetGitDirEnvs() {
_ = os.Unsetenv("GIT_DIR")
_ = os.Unsetenv("GIT_WORK_TREE")
}