From: Richard Hartmann Date: Wed, 22 Oct 2014 22:44:36 +0000 (+0200) Subject: vcsh: list_untracked(): Avoid `cut`; speed up `-r` X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/3a72a809b8681ed08ec45065089a5bd7d1b8cf4d?ds=inline;hp=de1c75a12e9f0f586b1973d3866ad4707d263a08 vcsh: list_untracked(): Avoid `cut`; speed up `-r` Avoid spawning `cut` and speed recursive mode up from "takes several seconds on a current machine" to "instant". Thanks to Thorsten Glaser. --- diff --git a/vcsh b/vcsh index a374f05..1d947d1 100755 --- a/vcsh +++ b/vcsh @@ -306,7 +306,7 @@ list_untracked() { git ls-files --others "$directory_opt" | ( while read line; do echo "$line" - directory_component="$(echo "$line" | cut -d'/' -f1)" + directory_component=${line%%/*} [ -d "$directory_component" ] && printf '%s/\n' "$directory_component" done ) | sort -u > $temp_file_others