diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-01-04 17:38:10 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-01-04 17:38:10 -0500 |
commit | 788ae5a34c0fad2e3c0788a745400a138d735195 (patch) | |
tree | 2517eb3ccf206f4ed7b6ef6a1d543c87caaf2e41 /init.d/50vcs-ignore | |
parent | 69739dd0341ba72a645344ea14658f0ede006079 (diff) | |
parent | fd4a85189390d6e6f022eb8f71fcecb5d5f82958 (diff) |
Merge branch 'hg'
Significantly refactored
Diffstat (limited to 'init.d/50vcs-ignore')
-rwxr-xr-x | init.d/50vcs-ignore | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/init.d/50vcs-ignore b/init.d/50vcs-ignore new file mode 100755 index 0000000..18f368e --- /dev/null +++ b/init.d/50vcs-ignore @@ -0,0 +1,70 @@ +#!/bin/sh +set -e + +if [ "$VCS" = git ] && [ ! -e .gitignore ]; then + file=.gitignore +elif [ "$VCS" = hg ] && [ ! -e .hgignore ]; then + file=.hgignore +fi + +if [ -z "$file" ] || [ -e "$file" ]; then + exit 0 +fi + +nl() { + echo >>$file +} + +comment() { + comment="$1" + echo "# $comment" >>$file +} + +ignore() { + glob="$1" + + case "$VCS" in + git) + echo "$glob" >> $file + ;; + hg) + # rather than converting the glob to a regexp, just + # configure hg to use globs + if [ -z "$hg_syntax_printed" ]; then + comment "use glob syntax" + echo "syntax: glob" >> $file + nl + hg_syntax_printed=1 + fi + echo "$glob" >> $file + ;; + esac +} + +if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then + comment "new and old versions of conffiles, stored by dpkg" + ignore "*.dpkg-*" + nl +elif [ "$LOWLEVEL_PACKAGE_MANAGER" = "pacman-g2" ]; then + comment "new and old versions of conffiles, stored by pacman" + ignore "*.pacnew" + ignore "*.pacorig" + ignore "*.pacsave" + nl +fi + +ignore "*~" +nl + +comment "mount(8) records system state here, no need to store these" +ignore blkid.tab +ignore blkid.tab.old +nl + +comment "some other files in /etc that typically do not need to be tracked" +ignore ld.so.cache +ignore mtab +ignore .pwd.lock +ignore network/run +ignore adjtime +nl |