Skip to content

Commit 0b89ccc

Browse files
committed
fix(vcs): remove empty paths from repo.get_tracked_files()
1 parent 235c30c commit 0b89ccc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/taskgraph/util/vcs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def _files_template(self, diff_filter):
290290
return template
291291

292292
def get_tracked_files(self, *paths, rev=None):
293+
paths = [p for p in paths if p]
293294
rev = rev or "."
294295
return self.run("files", "-r", rev, *paths).splitlines()
295296

@@ -476,6 +477,7 @@ def get_commit_message(self, revision=None):
476477
return self.run("log", "-n1", "--format=%B", revision)
477478

478479
def get_tracked_files(self, *paths, rev=None):
480+
paths = [p for p in paths if p]
479481
rev = rev or "HEAD"
480482
return self.run("ls-tree", "-r", "--name-only", rev, *paths).splitlines()
481483

test/test_util_vcs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def test_get_tracked_files(repo):
229229
repo.run("commit", "-m", "Add second file")
230230
rev = ".~1" if repo.tool == "hg" else "HEAD~1"
231231
assert_files(repo.get_tracked_files(), ["first_file", "subdir/second_file"])
232+
assert_files(repo.get_tracked_files(""), ["first_file", "subdir/second_file"])
232233
assert_files(repo.get_tracked_files("subdir"), ["subdir/second_file"])
233234
assert_files(repo.get_tracked_files(rev=rev), ["first_file"])
234235

0 commit comments

Comments
 (0)