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.
+ <none> will not write any ignore file.
+
Defaults to <exact>.
Less interesting knobs you could turn:
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
}
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
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
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