Skip to content

Commit

Permalink
fix issue datalad#559, a Windows line endings-related bug
Browse files Browse the repository at this point in the history
This commit fixes issue datalad#559. It allows `itemize`
to any of multiple line-separators to separate the
output of `git annex find`. This takes care of the
fact that some git-annex versions will output
an unrequested `'\r'` in addition to a requested
`'\n'`.
  • Loading branch information
christian-monch committed Dec 7, 2023
1 parent bd59fce commit 14b1504
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions datalad_next/iter_collections/annexworktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ def iter_annexworktree(
route_out(
itemize(
gaf,
# git-annex changed its line-ending behavior, but
# we should be safe, because we declare a specific
# format for git-annex-find above
sep=b'\n',
# although we declare a specific key output format
# for the git-annex find call, some versions of
# git-annex on Windows will terminate the key output
# with '\r\n' instead of '\n'. We therefore use
# `None` as separator, which enables `itemize()`
# to use either separator, i.e. '\r\n' or '\n'.
sep=None,
),
# we need this route-out solely for the purpose
# of maintaining a 1:1 relationship of items reported
Expand Down

0 comments on commit 14b1504

Please sign in to comment.