From 1c9b4bf99dba2153217b6c192a699e292de4d135 Mon Sep 17 00:00:00 2001 From: Des Preston Date: Mon, 19 Jul 2021 16:33:51 -0400 Subject: [PATCH] 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 --- internal/config/config_file.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/config/config_file.go b/internal/config/config_file.go index 304ea3327..972f94d2b 100644 --- a/internal/config/config_file.go +++ b/internal/config/config_file.go @@ -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) }