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

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: do not create .gitignore.d if VCSH_GITIGNORE == none
[code/vcsh.git] / vcsh
diff --git a/vcsh b/vcsh
index f1f50def85502ff90d21f0d1b0f6ae1e380cb15d..e74910e9aca883a0c92673b7a7b60a8f5f41866a 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -260,7 +260,7 @@ which() {
 
 write_gitignore() {
        # Don't do anything if the user does not want to write gitignore
 
 write_gitignore() {
        # Don't do anything if the user does not want to write gitignore
-       if [ "x$VCSH_GITIGNORE" = 'xnone' ] then
+       if [ "x$VCSH_GITIGNORE" = 'xnone' ]; then
                info "Not writing gitignore as '\$VCSH_GITIGNORE' is set to 'none'"
                exit
        fi
                info "Not writing gitignore as '\$VCSH_GITIGNORE' is set to 'none'"
                exit
        fi
@@ -358,9 +358,8 @@ if echo $VCSH_REPO_NAME | grep -q '/'; then
        export VCSH_REPO_NAME=$(basename "$VCSH_REPO_NAME" .git)
 fi
 
        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
        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
                        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')
 
 verbose "$VCSH_COMMAND begin"
 export VCSH_COMMAND=$(echo $VCSH_COMMAND | sed 's/-/_/g')