diff --git a/src/taskgraph/util/vcs.py b/src/taskgraph/util/vcs.py index 80f08e4d..92c1a634 100644 --- a/src/taskgraph/util/vcs.py +++ b/src/taskgraph/util/vcs.py @@ -290,6 +290,7 @@ def _files_template(self, diff_filter): return template def get_tracked_files(self, *paths, rev=None): + paths = [p for p in paths if p] rev = rev or "." return self.run("files", "-r", rev, *paths).splitlines() @@ -476,6 +477,7 @@ def get_commit_message(self, revision=None): return self.run("log", "-n1", "--format=%B", revision) def get_tracked_files(self, *paths, rev=None): + paths = [p for p in paths if p] rev = rev or "HEAD" return self.run("ls-tree", "-r", "--name-only", rev, *paths).splitlines() diff --git a/test/test_util_vcs.py b/test/test_util_vcs.py index 7585fe36..6d5d2f10 100644 --- a/test/test_util_vcs.py +++ b/test/test_util_vcs.py @@ -229,6 +229,7 @@ def test_get_tracked_files(repo): repo.run("commit", "-m", "Add second file") rev = ".~1" if repo.tool == "hg" else "HEAD~1" assert_files(repo.get_tracked_files(), ["first_file", "subdir/second_file"]) + assert_files(repo.get_tracked_files(""), ["first_file", "subdir/second_file"]) assert_files(repo.get_tracked_files("subdir"), ["subdir/second_file"]) assert_files(repo.get_tracked_files(rev=rev), ["first_file"])