mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-10 11:10:18 +02:00
4c5b1574f1
There are quite a few paths you might want to get e.g. the repo's path, the worktree's path, the repo's git dir path, the worktree's git dir path. I want these all obtained once and then used when needed rather than having to have IO whenever we need them. This is not so much about reducing time spent on IO as it is about not having to care about errors every time we want a path.
20 lines
285 B
Go
20 lines
285 B
Go
package env
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
// This package encapsulates accessing/mutating the ENV of the program.
|
|
|
|
func GetGitDirEnv() string {
|
|
return os.Getenv("GIT_DIR")
|
|
}
|
|
|
|
func SetGitDirEnv(value string) {
|
|
os.Setenv("GIT_DIR", value)
|
|
}
|
|
|
|
func UnsetGitDirEnv() {
|
|
_ = os.Unsetenv("GIT_DIR")
|
|
}
|