Skip to content

Commit

Permalink
fix: unpack status results differently
Browse files Browse the repository at this point in the history
If we point inside a subdataset, repo.status will use the subdataset
path, and not the given path, as the key in the returned
dictionary. This would crash checks for paths leading into subdatasets
and is now fixed by simply taking the first value from the
dictionary (we ask about a single path, so there should be just one
status; an assertion is added just in case). Closes #15
  • Loading branch information
mslw committed Feb 8, 2023
1 parent 7a9162f commit bf6a3ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion datalad_redcap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def check_ok_to_edit(filepath: Path, ds: Dataset) -> Tuple[bool, bool]:
ok_to_edit = True
unlock = False
else:
st_fp = st[filepath] # need to unpack
assert len(st) == 1
st_fp = next(iter(st.values()))
if st_fp["type"] == "file" and st_fp["state"] == "clean":
ok_to_edit = True
unlock = False
Expand Down

0 comments on commit bf6a3ce

Please sign in to comment.