Skip to content

Commit 673e6c2

Browse files
committed
fix(iter_gitstatus): rectify usage of unsupport untracked=no mode in tests
Disabling untracked reporting is done with the parameter value `None`. This is uniformly communicated in the docstrings. Only the tests used and undocumented `'no'` value. This change removes support for `'no'` and aligns the implementation with the documentation.
1 parent 2851ec4 commit 673e6c2

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

datalad_next/iter_collections/gitstatus.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _yield_dir_items(
152152
GitTreeItemType.directory,
153153
GitTreeItemType.submodule,
154154
)
155-
if untracked == 'no':
155+
if untracked is None:
156156
# no need to look at anything other than the diff report
157157
dir_items = {}
158158
else:
@@ -191,7 +191,7 @@ def _yield_dir_items(
191191
if dir_path.exists():
192192
item.add_modification_type(
193193
GitContainerModificationType.modified_content)
194-
if untracked != 'no' \
194+
if untracked is not None \
195195
and _path_has_untracked(path / item.path):
196196
item.add_modification_type(
197197
GitContainerModificationType.untracked_content)
@@ -204,7 +204,7 @@ def _yield_dir_items(
204204
if item.status:
205205
yield item
206206

207-
if untracked == 'no':
207+
if untracked is None:
208208
return
209209

210210
# yield anything untracked, and inspect remaining containers
@@ -302,7 +302,7 @@ def _yield_repo_items(
302302
if item.status:
303303
yield item
304304

305-
if untracked == 'no':
305+
if untracked is None:
306306
return
307307

308308
# lastly untracked files of this repo

datalad_next/iter_collections/gitworktree.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
decode_bytes,
2424
itemize,
2525
)
26-
from datalad_next.gitpathspec import (
27-
GitPathSpec,
28-
GitPathSpecs,
29-
)
26+
from datalad_next.gitpathspec import GitPathSpecs
3027
from .utils import (
3128
FileSystemItem,
3229
FileSystemItemType,

datalad_next/iter_collections/tests/test_itergitstatus.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def test_status_homogeneity(modified_dataset):
3838
dict(path=ds.pathobj, eval_submodule_state='commit', recursive='repository'),
3939
dict(path=ds.pathobj, eval_submodule_state='commit', recursive='submodules'),
4040
# without untracked
41-
dict(path=ds.pathobj, untracked='no', recursive='no'),
42-
dict(path=ds.pathobj, untracked='no', recursive='repository'),
43-
dict(path=ds.pathobj, untracked='no', recursive='submodules'),
41+
dict(path=ds.pathobj, untracked=None, recursive='no'),
42+
dict(path=ds.pathobj, untracked=None, recursive='repository'),
43+
dict(path=ds.pathobj, untracked=None, recursive='submodules'),
4444
# special untracked modes
4545
dict(path=ds.pathobj, untracked='whole-dir', recursive='no'),
4646
dict(path=ds.pathobj, untracked='whole-dir', recursive='repository'),

0 commit comments

Comments
 (0)