Skip auto migrate of config when GH_CONFIG_DIR

If GH_CONFIG_DIR is set, don't auto migrate the config file. This fixes
the situation where the path given via GH_CONFIG_DIR does not exist and
the cli attempts to migrate an existing config to that location.

Fixes #3837
This commit is contained in:
Des Preston 2021-07-19 16:33:51 -04:00
parent 161de77fd7
commit 1c9b4bf99d

View file

@ -40,8 +40,9 @@ func ConfigDir() string {
path = filepath.Join(d, ".config", "gh")
}
// If the path does not exist try migrating config from default paths
if !dirExists(path) {
// If the path does not exist and the GH_CONFIG_DIR flag is not set try
// migrating config from default paths.
if !dirExists(path) && os.Getenv(GH_CONFIG_DIR) == "" {
_ = autoMigrateConfigDir(path)
}