Open dg1727 opened 4 years ago
Hm, yeah sounds valid. Maybe an extra line before a prompt highlighting that we'd search everywhere and it may take a long time should be enough.
Would you be able to open a pull request for the proposed change by any chance?
I was glancing over
install.sh
and I noticed that (starting at line 3829) it currently says:printf 'Git hook template directory not found in /usr. '
printf 'Do you want to keep searching? [y/N] '
read -r DO_SEARCH </dev/tty
`
if [ "${DO_SEARCH}" = "y" ] || [ "${DO_SEARCH}" = "Y" ]; thenWhat with symlinks, network mounts, large folder trees that the user wouldn't want to search because they are obviously irrelevant, and other problematic regions of the filesystem, searching from "/" could take a long time unless the
find
command (used by yoursearch_pre_commit_sample_file
function) is better optimised than I've noticed.If the user chose Y in the case quoted above, I suggest prompting the user for the start location for the search, and also warning the user that the default of "/" may take a long time (the warning is to make unsuspecting users take notice; otherwise, they may just press
y
and ENTER without thinking, or they may assume thatinstall.sh
has an algorithm that skips over network mounts etc.). You may also prompt the user that there is a special value that can be entered (maybe "//" or something) that is equivalent to having answered N at the "Do you want to keep searching" prompt (that is, canceling the search even after the user answeredy
at the prompt).If I'm mistaken about
find
, then it might be a good idea to add a one-line comment like "In practice, this usually doesn't take as much time as it looks like" so other people don't have the same concern I did.