]> git.madduck.net Git - code/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

vcsh: list_untracked(): Avoid `cut`; speed up `-r`
authorRichard Hartmann <richih@debian.org>
Wed, 22 Oct 2014 22:44:36 +0000 (00:44 +0200)
committerRichard Hartmann <richih@debian.org>
Wed, 22 Oct 2014 22:44:36 +0000 (00:44 +0200)
Avoid spawning `cut` and speed recursive mode up from "takes several seconds on a
current machine" to "instant".

Thanks to Thorsten Glaser.

vcsh

diff --git a/vcsh b/vcsh
index a374f05b4c74d710116f50eb3b6a11575f236299..1d947d1ae920db1a81e76be3a86bf5a700ff4e25 100755 (executable)
--- 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