Selaa lähdekoodia

ignore: Fix default_user_ignore_filter_path when HOME is not set

For example on Windows.
Segev Finer 7 vuotta sitten
vanhempi
commit
52cbc5a9c0
1 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 4 4
      dulwich/ignore.py

+ 4 - 4
dulwich/ignore.py

@@ -206,10 +206,10 @@ def default_user_ignore_filter_path(config):
     except KeyError:
         pass
 
-    if os.environ.get('XDG_CONFIG_HOME', ''):
-        return os.path.join(os.environ['XDG_CONFIG_HOME'], 'git', 'ignore')
-    else:
-        return os.path.join(os.environ['HOME'], '.config', 'git', 'ignore')
+    xdg_config_home = os.environ.get(
+        "XDG_CONFIG_HOME", os.path.expanduser("~/.config/"),
+    )
+    return os.path.join(xdg_config_home, 'git', 'ignore')
 
 
 class IgnoreFilterManager(object):