aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-29 18:59:36 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-29 18:59:36 +1200
commit9307773a1eefe63b1fd27be133830df80b0c7e1a (patch)
tree5c8140d2fb8a56c231f09642c43580cc16ef5fef
parentMerge branch 'release/v5.6.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-5.7.0.tar.gz (sig)
dotfiles-5.7.0.zip
Merge branch 'release/v5.7.0'v5.7.0
* release/v5.7.0: Skip blanks around ignored lines in merge commits Skip consecutive blanks in merge commits Remove unneeded regex escape Don't try to read hook arguments beyond the first Handle blank lines and comments in merge commits Adjust prepare-commit-msg hook to arguments Exclude files with extension from Git hooks Correct name of message filter hook Add an idea for a new approach to Git hooks Add an idea for a new Git hook Add an attempt at a commit merge message filter Add some nice comments to post-update Git hook Refine shebang patterns in scripts.vim a bit Update vim-big-file-options to v2.1.0
-rw-r--r--.gitignore1
-rw-r--r--IDEAS.md5
-rw-r--r--Makefile5
-rw-r--r--VERSION4
-rw-r--r--git/template/hooks/post-update.sh7
-rwxr-xr-xgit/template/hooks/prepare-commit-msg.awk45
m---------vim/bundle/big_file_options0
-rw-r--r--vim/scripts.vim18
8 files changed, 72 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 6b634a75..23074970 100644
--- a/.gitignore
+++ b/.gitignore
@@ -170,6 +170,7 @@
/games/zs
/git/gitconfig
/git/gitconfig.m4
+/git/template/hooks/prepare-commit-msg
/git/template/hooks/post-update
/gnupg/gpg.conf
/gnupg/gpg.conf.m4
diff --git a/IDEAS.md b/IDEAS.md
index 146f7b95..968065b1 100644
--- a/IDEAS.md
+++ b/IDEAS.md
@@ -32,3 +32,8 @@ Ideas
* Write a ftplugin for Perl to switch between punctuation variable names and
English variable names., i.e. \e on `$?` would change to `$CHILD_ERROR`, and
vice-versa.
+* Could probably put my pre-commit hook that bans commits to master in here;
+ maybe make it a bit smarter by only banning commits to master if a branch
+ named "develop" exists
+* Almost definitely going to want to try a runparts layout for Git hooks at
+ some point
diff --git a/Makefile b/Makefile
index 27b2ad2b..6612a5d3 100644
--- a/Makefile
+++ b/Makefile
@@ -263,7 +263,8 @@ GAMES = games/aaf \
games/xyzzy \
games/zs
-GIT_TEMPLATE_HOOKS = git/template/hooks/post-update
+GIT_TEMPLATE_HOOKS = git/template/hooks/post-update \
+ git/template/hooks/prepare-commit-msg
all: $(BINS) git/gitconfig $(GIT_TEMPLATE_HOOKS) gnupg/gpg.conf
@@ -425,7 +426,7 @@ install-git: git/gitconfig $(GIT_TEMPLATE_HOOKS)
-type d -exec sh -c 'mkdir -p -- \
$(HOME)/.git-template"$${1#git/template}"' \
_ {} \; \
- -o ! -name '*.sh' -exec sh -c 'cp -p -- "$$1" \
+ -o ! -name '*.*' -exec sh -c 'cp -p -- "$$1" \
$(HOME)/.git-template"$${1#git/template}"' \
_ {} \;
diff --git a/VERSION b/VERSION
index 88577c7e..8a5ce1cc 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v5.6.0
-Wed May 29 04:20:42 UTC 2019
+tejr dotfiles v5.7.0
+Wed May 29 18:15:54 NZST 2019
diff --git a/git/template/hooks/post-update.sh b/git/template/hooks/post-update.sh
index 7199a513..232c0ecd 100644
--- a/git/template/hooks/post-update.sh
+++ b/git/template/hooks/post-update.sh
@@ -1,4 +1,11 @@
+# Update server info automatically if this is a bare repository
+
+# Get whether this is bare from git-config(1); this returns the strings 'true'
+# or 'false'; I don't think you can coerce the exit value instead, which would
+# have been nice
bare=$(git config core.bare)
+
+# If it's 'true', update the server info so that this works via cgit or Gitweb
case $bare in
true) git update-server-info ;;
esac
diff --git a/git/template/hooks/prepare-commit-msg.awk b/git/template/hooks/prepare-commit-msg.awk
new file mode 100755
index 00000000..2fe43c5b
--- /dev/null
+++ b/git/template/hooks/prepare-commit-msg.awk
@@ -0,0 +1,45 @@
+# Filter to clean up a merge commit; still experimental on tejr's part.
+
+# If the second argument to this script is "merge", this is a merge commit, and
+# we know we need to filter it; otherwise we can just bail out directly
+BEGIN {
+ if (ARGV[2] != "merge")
+ exit(0)
+ message = ARGV[1]
+ ARGC = 2
+}
+
+# This line starts with an asterisk, so we're starting the commit listings for
+# a new branch; save the whole line into a variable and skip to the next line
+/^\* / {
+ branch = $0
+ next
+}
+
+# Commit message subject patterns to skip go here; be as precise as you can
+$0 == " Bump VERSION" { next } # Skip version number bumps
+
+# This line is blank, or a comment; reset the branch
+!NF || $1 ~ /^#/ { branch = 0 }
+
+# Don't emit consecutive blanks
+NF { blank = 0 }
+!NF && blank++ { next }
+
+# If we got past this point, we have an actual commit line to include, so if
+# there's a branch heading yet to print, we should do so now; add it to the
+# line buffer
+branch {
+ lines[++l] = branch
+ branch = 0
+}
+
+# Add the current line to the line buffer
+{ lines[++l] = $0 }
+
+# If we set the message filename in BEGIN due to this being a merge commit,
+# write our filtered message back to that file, and we're done
+END {
+ for (i = 1; message && i <= l; i++)
+ print lines[i] > message
+}
diff --git a/vim/bundle/big_file_options b/vim/bundle/big_file_options
-Subproject b7fa83df2c41e795b4c704f0ba3a77c6cbccd97
+Subproject 4aa756a6545e5646926c82fb9982253455b02d4
diff --git a/vim/scripts.vim b/vim/scripts.vim
index b69b89f5..31b980f2 100644
--- a/vim/scripts.vim
+++ b/vim/scripts.vim
@@ -11,7 +11,7 @@ if s:line !~# '^#!'
endif
" AWK
-if s:line =~# '\<[gm]\=awk\>'
+if s:line =~# '\<[gm]\=awk\d*\>'
setfiletype awk
" Perl 5
@@ -23,28 +23,28 @@ elseif s:line =~# '\<perl6\>'
setfiletype perl6
" PHP
-elseif s:line =~# '\<php\>'
+elseif s:line =~# '\<php\d*\>'
setfiletype php
" Python
-elseif s:line =~# '\<python[23]\=\>'
+elseif s:line =~# '\<python\d*\>'
setfiletype python
" Ruby
-elseif s:line =~# '\<ruby[23]\=\>'
+elseif s:line =~# '\<ruby\d*\>'
setfiletype ruby
" sed
-elseif s:line =~# '\<sed\>'
+elseif s:line =~# '\<sed\d*\>'
setfiletype sed
" Bash
-elseif s:line =~# '\<bash\>'
+elseif s:line =~# '\<bash\d*\>'
let b:is_bash = 1
setfiletype sh
-" Korn shell
-elseif s:line =~# '\<\%(\ksh\|ksh93\|mksh\|pdksh\)\>'
+" Korn shell; either starts or ends in 'ksh'
+elseif s:line =~# '\<ksh\|ksh\d*\>'
let b:is_kornshell = 1
setfiletype sh
@@ -54,7 +54,7 @@ elseif s:line =~# '\<sh\>'
setfiletype sh
" TCL
-elseif s:line =~# '\<\%(expect\|tcl\|wish\)\>'
+elseif s:line =~# '\<\%(expect\|tcl\|wish\)\d*\>'
setfiletype tcl
endif