From c03340ae79c2230828c3b3e15a314e167f637d2e Mon Sep 17 00:00:00 2001
From: Richard Hartmann <richih@debian.org>
Date: Thu, 23 Oct 2014 20:45:06 +0200
Subject: [PATCH] vcsh: Factor out code from status() into status_helper()

---
 vcsh | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/vcsh b/vcsh
index 9480b48..54026cf 100755
--- a/vcsh
+++ b/vcsh
@@ -361,22 +361,23 @@ run() {
 
 status() {
 	if [ -n "$VCSH_REPO_NAME" ]; then
-		GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
-		use
-		git status --short --untracked-files='no'
-		VCSH_COMMAND_RETURN_CODE=$?
+		status_helper $VCSH_REPO_NAME
 	else
 		for VCSH_REPO_NAME in $(list); do
 			echo "$VCSH_REPO_NAME:"
-			GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
-			use
-			git status --short --untracked-files='no'
-			VCSH_COMMAND_RETURN_CODE=$?
+			status_helper $VCSH_REPO_NAME
 			echo
 		done
 	fi
 }
 
+status_helper() {
+	GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+	use
+	git status --short --untracked-files='no'
+	VCSH_COMMAND_RETURN_CODE=$?
+}
+
 upgrade() {
 	hook pre-upgrade
 	# fake-bare repositories are not bare, actually. Set this to false
-- 
GitLab