dulwich
dulwich copied to clipboard
porcelain's status/get_untracked_paths fails to return untracked files in the top level of the git
The porcelain status function and the get_untracked_paths function that it calls do not return new untracked files that are in the repo's top level. Unit tests only check that this works in the nested directories, checks on the top level are not implemented with asserts.
https://github.com/jelmer/dulwich/blob/master/dulwich/porcelain.py#L1374
file_path = r.path / "sample.txt"
file_path.write_text("top level")
list(porcelain.get_untracked_paths(repo.path, repo.path, repo.open_index(), exclude_ignored=False, untracked_files="all"))
[]
# NOTE THE ABOVE SHOULD SHOW sample.txt!!!
Path(repo.path/"tempdir").mkdir()
dfile_path.write_text("nested")
list(porcelain.get_untracked_paths(repo.path, repo.path, repo.open_index(), exclude_ignored=False, untracked_files="all"))
['tempdir/sample.txt']
The status function calls into this get_untracked_paths the same way and thus has the same behavior.