Last active
December 8, 2023 09:58
-
-
Save xkr47/8bc17d69f5b8733250c0 to your computer and use it in GitHub Desktop.
cvsignore -> gitignore converter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ ! -d .git ]; then | |
echo ERROR: Please run this in the root of the git repository | |
exit 1 | |
fi | |
cat > .gitignore <<'EOF' | |
# CVS global ignores | |
RCS | |
SCCS | |
CVS | |
CVS.adm | |
RCSLOG | |
cvslog.* | |
tags | |
TAGS | |
.make.state | |
.nse_depinfo | |
*~ | |
#* | |
.#* | |
,* | |
_$* | |
*$ | |
*.old | |
*.bak | |
*.BAK | |
*.orig | |
*.rej | |
.del-* | |
*.a | |
*.olb | |
*.o | |
*.obj | |
*.so | |
*.exe | |
*.Z | |
*.elc | |
*.ln | |
core | |
EOF | |
split_cvsignore_line () { | |
perl -pe 's!^\s+!!;s!\s+!\n!g;' | |
} | |
if [ -r $HOME/.cvsignore -o "$CVSIGNORE" ]; then | |
echo '# User global ignores' | |
[ -r $HOME/.cvsignore ] && cat $HOME/.cvsignore | split_cvsignore_line | |
[ "$CVSIGNORE" ] && echo "$CVSIGNORE" | split_cvsignore_line | |
echo | |
fi >> .gitignore | |
echo '# Project ignores (converted from .cvsignore files)' >> .gitignore | |
find -name .cvsignore | while read f ; do | |
dir="$(dirname "$f" | sed -r 's:^\.::')" | |
cat "$f" | split_cvsignore_line | awk '{print "'"$dir"'/"$1}' >> .gitignore | |
git rm -f "$f" | |
done | |
git add .gitignore | |
git commit -m 'Automatically converted .cvsignore files to .gitignore using https://gist.github.com/xkr47/8bc17d69f5b8733250c0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Improved version of http://stackoverflow.com/a/24016535/1356047