mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-14 11:23:09 +02:00
595e28d335
This was on oversight on my part: I assumed that the --work-tree arg was always intended for use with linked worktrees which have a .git file pointing back to the repo. I'm honestly confused now: seems like there are three kinds of worktrees: * the main worktree of a non-bare repo * a linked worktree (with its own gitdir in the repo's worktrees/ dir) * a random folder which you specify as a worktree with the --work-tree arg I'm pretty sure the --work-tree arg is only intended to be used with this third kind or workree
29 lines
471 B
Go
29 lines
471 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 GetWorkTreeEnv() string {
|
|
return os.Getenv("GIT_WORK_TREE")
|
|
}
|
|
|
|
func SetWorkTreeEnv(value string) {
|
|
os.Setenv("GIT_WORK_TREE", value)
|
|
}
|
|
|
|
func UnsetGitLocationEnvVars() {
|
|
_ = os.Unsetenv("GIT_DIR")
|
|
_ = os.Unsetenv("GIT_WORK_TREE")
|
|
}
|