hf
hf copied to clipboard
Symlink support
Currently, hf doesn’t seem to list symlinks pointing to files. This isn’t a problem if the files are accessible as regular files too (though some people might prefer having the symlink names available anyway, since their names might be different). However, in some use-cases, the symlinks might point to destinations which are otherwise pruned away (e. g., a file in a dotted directory); this will then lead to some files not available listed for completion at all.
E. g., git-annex stores large BLOBs in git by managing them as symlinks to a path of the form .git/annex/objects/…. I keep notes and lots of other stuff in these repositories, and accordingly none of the filenames are currently given as completions when using hf.
Unfortunately .git folders are ignored - do you have any suggestion to fix this?
My thought was that if one just lists the link names nominally (without dereferencing them), there should be no .git prefix, so the pruning logics for dotted directories should not be a problem, should they? IMHO not dereferencing the symlinks is preferable in any case. So, when walking the files, could you include (or add an option to include) symlinks as well as regular files?
hf is meant to only complete files, right? I guess in that case, in addition to the above, you’d also want to check whether the link targets are regular files (so you’d dereference temporarily for this check, but you’d still return the name of the link, not the name of the target).
Would this work?