Kaynağa Gözat

ctags git hook

Andrew Swistak 8 yıl önce
ebeveyn
işleme
da68ebe514

+ 1 - 0
bin/manage_dotfiles.sh

@@ -54,6 +54,7 @@ install_dotfiles() {
     'fehbg'
     'gitconfig'
     'gitignore'
+    'git_template'
     'gtkrc-2.0'
     'vim'
     'vimrc'

+ 8 - 0
git_template/hooks/ctags

@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+PATH="/usr/local/bin:$PATH"
+dir="`git rev-parse --git-dir`"
+trap 'rm -f "$dir/$$.tags"' EXIT
+git ls-files | \
+  ctags --tag-relative=yes -L - -f"$dir/$$.tags" --languages=-javascript,sql
+mv "$dir/$$.tags" "$dir/tags"

+ 2 - 0
git_template/hooks/post-checkout

@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &

+ 2 - 0
git_template/hooks/post-commit

@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &

+ 2 - 0
git_template/hooks/post-merge

@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &

+ 4 - 0
git_template/hooks/post-rewrite

@@ -0,0 +1,4 @@
+#!/bin/sh
+case "$1" in
+  rebase) exec .git/hooks/post-merge ;;
+esac

+ 3 - 0
gitconfig

@@ -15,6 +15,7 @@
   ca = commit -a
   d = diff
   ch = checkout
+  ctags = !.git/hooks/ctags
 [core]
   editor = nvim
   pager = less -F -X
@@ -37,3 +38,5 @@
 [url "github:"]
   insteadOf = git@github.com
   insteadOf = github.com
+[init]
+  templatedir = ~/.git_template