Respect $GIT_WORK_TREE and $GIT_DIR env vars (fix #3010). (#3024)

This commit is contained in:
Jesse Duffield 2023-09-26 23:52:19 +10:00 committed by GitHub
commit 2c29577e3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,10 +180,10 @@ func parseCliArgsAndEnvVars() *cliArgs {
useConfigDir := ""
flaggy.String(&useConfigDir, "ucd", "use-config-dir", "override default config directory with provided directory")
workTree := ""
workTree := os.Getenv("GIT_WORK_TREE")
flaggy.String(&workTree, "w", "work-tree", "equivalent of the --work-tree git argument")
gitDir := ""
gitDir := os.Getenv("GIT_DIR")
flaggy.String(&gitDir, "g", "git-dir", "equivalent of the --git-dir git argument")
customConfigFile := ""