瀏覽代碼

Expand ~ in global exclude path.

Jelmer Vernooij 5 年之前
父節點
當前提交
ed4037327b
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 2 0
      NEWS
  2. 3 4
      dulwich/ignore.py

+ 2 - 0
NEWS

@@ -13,6 +13,8 @@
 
  * Cleanup new directory if clone fails. (Jelmer Vernooij, #733)
 
+ * Expand "~" in global exclude path. (Jelmer Vernooij)
+
 0.19.13	2019-08-19
 
  BUG FIXES

+ 3 - 4
dulwich/ignore.py

@@ -271,9 +271,7 @@ def default_user_ignore_filter_path(config):
     except KeyError:
         pass
 
-    xdg_config_home = os.environ.get(
-        "XDG_CONFIG_HOME", os.path.expanduser("~/.config/"),
-    )
+    xdg_config_home = os.environ.get("XDG_CONFIG_HOME", "~/.config/")
     return os.path.join(xdg_config_home, 'git', 'ignore')
 
 
@@ -366,7 +364,8 @@ class IgnoreFilterManager(object):
                 os.path.join(repo.controldir(), 'info', 'exclude'),
                 default_user_ignore_filter_path(repo.get_config_stack())]:
             try:
-                global_filters.append(IgnoreFilter.from_path(p))
+                global_filters.append(
+                    IgnoreFilter.from_path(os.path.expanduser(p)))
             except IOError:
                 pass
         config = repo.get_config_stack()