From 809b0acc18fa84089f453bf69a177246bf400bdf Mon Sep 17 00:00:00 2001
From: Alessandro Ghedini <alessandro@ghedini.me>
Date: Wed, 10 Jul 2013 15:01:36 +0200
Subject: [PATCH] vcsh: do not create .gitignore.d if VCSH_GITIGNORE == none

---
 vcsh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vcsh b/vcsh
index 41b0ba6..e74910e 100755
--- a/vcsh
+++ b/vcsh
@@ -358,9 +358,8 @@ if echo $VCSH_REPO_NAME | grep -q '/'; then
 	export VCSH_REPO_NAME=$(basename "$VCSH_REPO_NAME" .git)
 fi
 
-
-for check_directory in "$VCSH_REPO_D" "$VCSH_BASE/.gitignore.d"
-do
+check_dir() {
+	check_directory=$1
 	if [ ! -d "$check_directory" ]; then
 		if [ -e "$check_directory" ]; then
 			fatal "'$check_directory' exists but is not a directory" 13
@@ -369,7 +368,10 @@ do
 			mkdir -p "$check_directory" || fatal "could not create '$check_directory'" 50
 		fi
 	fi
-done
+}
+
+check_dir "$VCSH_REPO_D"
+[ ! "x$VCSH_GITIGNORE" = 'xnone' ] && check_dir "$VCSH_BASE/.gitignore.d"
 
 verbose "$VCSH_COMMAND begin"
 export VCSH_COMMAND=$(echo $VCSH_COMMAND | sed 's/-/_/g')
-- 
GitLab