Filenames cannot start with a colon
kergoth opened this issue · comments
There's an issue with GitSession.list_tree_entries
due to a quirk in how git ls-tree
processes its paths (presumably common logic in how git handles its path specifications). This prevents paths from starting with a colon (git often separates the committish/tree from a path that way, so that may be the issue).
Example:
$ ls
:cht.sh cht.sh
$ git ls-tree HEAD cht.sh :cht.sh
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 cht.sh
$ git ls-tree HEAD ./cht.sh ./:cht.sh
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 :cht.sh
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 cht.sh
This causes problems for the particular case of using peru to pull in https://github.com/chubin/cheat.sh, as its url for installation is https://cht.sh/:cht.sh.
Afaict we can resolve this issue by prefixing all pathnames with ./
to explicitly specify that it's relative to pwd, much the way it's safest to do the same when writing shell scripts (i.e. canonical_path = os.path.join('.', pathlib.PurePosixPath(path))
, or we can add a specific workaround to do this only when the path begins with :
.
Good catch! I just landed c972dd4 to fix this. Is it easy for you to check that this works in your case? If it's not easy, I can go ahead and publish a new release, and we can cross our fingers :)
There are some test failures on Windows that I need to fix, since colons are reserved characters on Windows.
Edit: Should be fixed with e46ea5c.
Confirmed, works for me, thanks for the quick response and fix!
Released as 1.1.4.