diff --git a/README.md b/README.md index e5e1e6b..e86d358 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ * Remove 'export' from variables that don't need them * Make current directory red in prompt if non-writeable (ala fish) * Fix shell $PATH. Intelligently build up from only existent directories and ensure no-duplicates -* Git template with ctag/other hooks (http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html) Copyright (c) 2008-2011 Bodaniel Jeanes diff --git a/Rakefile b/Rakefile index 0bcf32d..15920a7 100644 --- a/Rakefile +++ b/Rakefile @@ -25,6 +25,7 @@ task :install do vcs/git/gitconfig vcs/git/gitignore vcs/git/gitk + vcs/git/git_template vcs/hg/hgrc ) diff --git a/vcs/git/git_template/hooks/ctags b/vcs/git/git_template/hooks/ctags new file mode 100755 index 0000000..a6aefef --- /dev/null +++ b/vcs/git/git_template/hooks/ctags @@ -0,0 +1,8 @@ +#!/bin/sh + +# See http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html + +new_tags_file="`mktemp -t ctags`" +ctags --tag-relative -Rf "${new_tags_file}" --exclude=.git --languages=-javascript,sql +mv "$new_tags_file" ".git/tags" + diff --git a/vcs/git/git_template/hooks/foo b/vcs/git/git_template/hooks/foo new file mode 100644 index 0000000..e69de29 diff --git a/vcs/git/git_template/hooks/post-checkout b/vcs/git/git_template/hooks/post-checkout new file mode 120000 index 0000000..ace4560 --- /dev/null +++ b/vcs/git/git_template/hooks/post-checkout @@ -0,0 +1 @@ +post-commit \ No newline at end of file diff --git a/vcs/git/git_template/hooks/post-commit b/vcs/git/git_template/hooks/post-commit new file mode 100755 index 0000000..fe9b110 --- /dev/null +++ b/vcs/git/git_template/hooks/post-commit @@ -0,0 +1,3 @@ +#!/bin/sh +.git/hooks/ctags >/dev/null 2>&1 & + diff --git a/vcs/git/git_template/hooks/post-merge b/vcs/git/git_template/hooks/post-merge new file mode 120000 index 0000000..ace4560 --- /dev/null +++ b/vcs/git/git_template/hooks/post-merge @@ -0,0 +1 @@ +post-commit \ No newline at end of file diff --git a/vcs/git/git_template/hooks/post-rewrite b/vcs/git/git_template/hooks/post-rewrite new file mode 100755 index 0000000..131f7d2 --- /dev/null +++ b/vcs/git/git_template/hooks/post-rewrite @@ -0,0 +1,5 @@ +#!/bin/sh +case "$1" in + rebase) exec .git/hooks/post-merge ;; +esac + diff --git a/vcs/git/gitconfig b/vcs/git/gitconfig index ad3a6ac..d196388 100644 --- a/vcs/git/gitconfig +++ b/vcs/git/gitconfig @@ -9,6 +9,7 @@ put = push origin HEAD push-all = "!for i in $(git config --list | grep -E ^remote\\..+\\.url | sed -E 's/^remote\\.(.*)\\.url=.*/\\1/'); do git push $i master; done" unadd = reset HEAD + ctags = !.git/hooks/ctags [apply] whitespace = nowarn [color] @@ -63,3 +64,5 @@ [github] user = bjeanes +[init] + templatedir = ~/.git_template