]> 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:

Support $VCSH_GITIGNORE == none
authorRichard Hartmann <richih.mailinglist@gmail.com>
Sun, 12 May 2013 19:50:03 +0000 (21:50 +0200)
committerRichard Hartmann <richih.mailinglist@gmail.com>
Sun, 12 May 2013 19:50:03 +0000 (21:50 +0200)
This will neither add core.excludesfile nor write a ignore file.

doc/vcsh.1.ronn
vcsh

index 4ec9548cf344b7238006941092e04564ca8a2b1c..7ebf9f5d77cccdaf82804f88c25ce73dd0f2c6cd 100644 (file)
@@ -151,14 +151,16 @@ executed in the context of your shell.
 Interesting knobs you can turn:
 
 * <$VCSH_GITIGNORE>:
 Interesting knobs you can turn:
 
 * <$VCSH_GITIGNORE>:
-  Can be either <exact> or <recursive>.
+  Can be <exact>, <recursive>, or <none>.
 
 
-  <exact> will seed the repo-specific <.gitignore> with all file and directory
+  <exact> will seed the repo-specific ignore file with all file and directory
   names which `git ls-files` returns.
 
   <recursive> will descend through all directories recursively additionally to
   the above.
 
   names which `git ls-files` returns.
 
   <recursive> will descend through all directories recursively additionally to
   the above.
 
+  <none> will not write any ignore file.
+
   Defaults to <exact>.
 
 Less interesting knobs you could turn:
   Defaults to <exact>.
 
 Less interesting knobs you could turn:
diff --git a/vcsh b/vcsh
index 7a0f7120171efa714ba3d413f00718bc20d57eed..f1f50def85502ff90d21f0d1b0f6ae1e380cb15d 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -238,7 +238,7 @@ upgrade() {
        hook pre-upgrade
        use
        git config core.worktree     "$GIT_WORK_TREE"
        hook pre-upgrade
        use
        git config core.worktree     "$GIT_WORK_TREE"
-       git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME"
+       [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME"
        git config vcsh.vcsh         'true'
        [ -e "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" ] && git add -f "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME"
        hook post-upgrade
        git config vcsh.vcsh         'true'
        [ -e "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" ] && git add -f "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME"
        hook post-upgrade
@@ -259,6 +259,12 @@ which() {
 }
 
 write_gitignore() {
 }
 
 write_gitignore() {
+       # Don't do anything if the user does not want to write gitignore
+       if [ "x$VCSH_GITIGNORE" = 'xnone' ] then
+               info "Not writing gitignore as '\$VCSH_GITIGNORE' is set to 'none'"
+               exit
+       fi
+
        use
        cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11
        gitignores=$(for file in $(git ls-files); do
        use
        cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11
        gitignores=$(for file in $(git ls-files); do
@@ -272,7 +278,7 @@ write_gitignore() {
        echo '*' > "$tempfile" || fatal "could not write to '$tempfile'" 57
        for gitignore in $gitignores; do
                echo "$gitignore" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57
        echo '*' > "$tempfile" || fatal "could not write to '$tempfile'" 57
        for gitignore in $gitignores; do
                echo "$gitignore" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57
-               if [ x$VCSH_GITIGNORE = x'recursive' ] && [ -d "$gitignore" ]; then
+               if [ "x$VCSH_GITIGNORE" = 'xrecursive' ] && [ -d "$gitignore" ]; then
                        { echo "$gitignore/*" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57; }
                fi
        done
                        { echo "$gitignore/*" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57; }
                fi
        done
@@ -289,8 +295,8 @@ write_gitignore() {
                fatal "could not move '$tempfile' to '$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME'" 53
 }
 
                fatal "could not move '$tempfile' to '$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME'" 53
 }
 
-if [ ! "x$VCSH_GITIGNORE" = 'xexact' ] && [ ! "x$VCSH_GITIGNORE" = 'xrecursive' ]; then
-       fatal "'\$VCSH_GITIGNORE' must be either 'exact' or 'recursive'" 1
+if [ ! "x$VCSH_GITIGNORE" = 'xexact' ] && [ ! "x$VCSH_GITIGNORE" = 'xrecursive' ] && [ ! "x$VCSH_GITIGNORE" = 'xnone' ]; then
+       fatal "'\$VCSH_GITIGNORE' must equal 'exact', 'recursive', or 'none'" 1
 fi
 
 if [ "$1" = 'clone' ]; then
 fi
 
 if [ "$1" = 'clone' ]; then