hf icon indicating copy to clipboard operation
hf copied to clipboard

Symlink support

Open eigengrau opened this issue 10 years ago • 2 comments

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.

eigengrau avatar Jul 27 '15 12:07 eigengrau

Unfortunately .git folders are ignored - do you have any suggestion to fix this?

hugows avatar Jul 27 '15 13:07 hugows

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?

eigengrau avatar Jul 27 '15 13:07 eigengrau