Created
December 3, 2013 10:20
-
-
Save dantesun/7767015 to your computer and use it in GitHub Desktop.
Create git repository with C/C++ files only and create tags
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/bash | |
DIR="$PWD" | |
GIT="/usr/bin/git" | |
echo "Generating tags in $DIR" | |
FILE_LIST=cscope.files | |
TAG_FILE=tags | |
if ! [ -d .git ]; then | |
echo "create Git repository" | |
$GIT init | |
echo "Add ignore rule" | |
cat > .gitignore <<__EOF | |
#Ignore everything | |
* | |
#Except directory | |
!*/ | |
#But always ignore the following directories | |
ut/ | |
#And includes the following files | |
!*.c++ | |
!*.cc | |
!*.cp | |
!*.cpp | |
!*.cxx | |
!*.h | |
!*.h++ | |
!*.hh | |
!*.hp | |
!*.hpp | |
!*.hxx | |
!*.C | |
!*.H | |
!*.c | |
__EOF | |
fi | |
function cost() | |
{ | |
/usr/bin/time -f "...%E elapsed." $* | |
} | |
rm -rf cscope.* | |
rm -rf $TAG_FILE | |
$GIT add ./\* | |
$GIT commit -am "DONT CARE" > /dev/null | |
$GIT ls-files > $FILE_LIST | |
wc -l $FILE_LIST | |
echo "Create cscope database" | |
cost cscope -b -q | |
echo "Create ctags" | |
cost ctags -f $TAG_FILE --sort=yes --c++-kinds=+xp --fields=+iaS --extra=+q -L $FILE_LIST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment