git » git-arr » commit 891a944

git: Don't use an empty pathspec when listing

author Alberto Bertogli
2017-08-27 16:37:12 UTC
committer Alberto Bertogli
2017-08-27 16:37:12 UTC
parent d7f0e4a2650734581d88b5c949868a8e7bcf788d

git: Don't use an empty pathspec when listing

An empty string as a pathspec element matches all paths, but git has
recently started complaining about it, as it could be problematic for
some operations like rm. In the future, it will be considered an error.

So this patch uses "." instead of the empty pathspec, as recommended.

https://github.com/git/git/commit/d426430e6ec2a05bf0a4ee88c319dd6072908504

git.py +4 -1

diff --git a/git.py b/git.py
index 636f3a2..2240175 100644
--- a/git.py
+++ b/git.py
@@ -525,7 +525,10 @@ class Tree:
             cmd.t = None
 
         cmd.arg(self.ref)
-        cmd.arg(path)
+        if not path:
+            cmd.arg(".")
+        else:
+            cmd.arg(path)
 
         for l in cmd.run():
             _mode, otype, _oid, size, name = l.split(None, 4)