소스 검색

ignore: Fix default_user_ignore_filter_path when HOME is not set

For example on Windows.
Segev Finer 7 년 전
부모
커밋
52cbc5a9c0
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  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):