浏览代码

Use Path.is_dir.

Jelmer Vernooij 4 年之前
父节点
当前提交
1bc24a278a
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      dulwich/porcelain.py

+ 3 - 2
dulwich/porcelain.py

@@ -522,9 +522,10 @@ def add(repo=".", paths=None):
         if not isinstance(paths, list):
             paths = [paths]
         for p in paths:
-            relpath = str(Path(p).resolve().relative_to(repo_path))
+            path = Path(p)
+            relpath = str(path.resolve().relative_to(repo_path))
             # FIXME: Support patterns
-            if os.path.isdir(p):
+            if path.is_dir():
                 relpath = os.path.join(relpath, "")
             if ignore_manager.is_ignored(relpath):
                 ignored.add(relpath)