From 3a72a809b8681ed08ec45065089a5bd7d1b8cf4d Mon Sep 17 00:00:00 2001
From: Richard Hartmann <richih@debian.org>
Date: Thu, 23 Oct 2014 00:44:36 +0200
Subject: [PATCH] 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.
---
 vcsh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
-- 
GitLab