From f4a805d1a2015a2a74e0a3191d871f52a20357dd Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 7 Nov 2019 08:26:46 -0700 Subject: normalise installation of git hooks --- lib/hooks/dotfiles-pre-push | 26 -------------------------- lib/hooks/git/dotfiles/pre-push | 26 ++++++++++++++++++++++++++ lib/hooks/git/propellor/post-checkout | 29 +++++++++++++++++++++++++++++ lib/hooks/propellor-post-checkout | 29 ----------------------------- 4 files changed, 55 insertions(+), 55 deletions(-) delete mode 100755 lib/hooks/dotfiles-pre-push create mode 100755 lib/hooks/git/dotfiles/pre-push create mode 100755 lib/hooks/git/propellor/post-checkout delete mode 100755 lib/hooks/propellor-post-checkout (limited to 'lib') diff --git a/lib/hooks/dotfiles-pre-push b/lib/hooks/dotfiles-pre-push deleted file mode 100755 index a3f048dc..00000000 --- a/lib/hooks/dotfiles-pre-push +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -remote="$1" -url="$2" - -z40=0000000000000000000000000000000000000000 - -while read local_ref local_sha remote_ref remote_sha; do - if [ "$local_sha" = $z40 ]; then - # Permit deletion of branches - : - else - if [ "$remote_ref" = "refs/heads/master" ]; then - if git verify-commit-by-fp \ - 8DC2487E51ABDD90B5C4753F0F56D0553B6D411B "$local_sha" - then - echo "Proposed new master has been signed by Sean" - else - echo >&2 "Proposed new master has not been PGP-signed by Sean" - exit 1 - fi - fi - fi -done - -exit 0 diff --git a/lib/hooks/git/dotfiles/pre-push b/lib/hooks/git/dotfiles/pre-push new file mode 100755 index 00000000..a3f048dc --- /dev/null +++ b/lib/hooks/git/dotfiles/pre-push @@ -0,0 +1,26 @@ +#!/bin/sh + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha; do + if [ "$local_sha" = $z40 ]; then + # Permit deletion of branches + : + else + if [ "$remote_ref" = "refs/heads/master" ]; then + if git verify-commit-by-fp \ + 8DC2487E51ABDD90B5C4753F0F56D0553B6D411B "$local_sha" + then + echo "Proposed new master has been signed by Sean" + else + echo >&2 "Proposed new master has not been PGP-signed by Sean" + exit 1 + fi + fi + fi +done + +exit 0 diff --git a/lib/hooks/git/propellor/post-checkout b/lib/hooks/git/propellor/post-checkout new file mode 100755 index 00000000..5118e81a --- /dev/null +++ b/lib/hooks/git/propellor/post-checkout @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Path::Class; +use autodie; + +(undef, my $head, my $flag) = @ARGV; +my $branch = `git name-rev --name-only $head`; +chomp $branch; + +if ( $flag && "$branch" ne "debian" ) { + # We create a cabal sandbox so that Emacs' haskell-mode ignores + # stack.yaml. We don't need to use stack because Propellor's deps + # are always installed as system packages + unless ( -d ".cabal-sandbox" ) { + system "cabal sandbox init"; + } + open my $fh, ">", ".dir-locals.el"; + print $fh <<'END'; +((nil . ((indent-tabs-mode . t) + (tab-width . 8) + (fill-column . 80))) + ;; Warn about spaces used for indentation: + (haskell-mode . ((eval . (highlight-regexp "^ +"))))) +END + close $fh; +} diff --git a/lib/hooks/propellor-post-checkout b/lib/hooks/propellor-post-checkout deleted file mode 100755 index 5118e81a..00000000 --- a/lib/hooks/propellor-post-checkout +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Path::Class; -use autodie; - -(undef, my $head, my $flag) = @ARGV; -my $branch = `git name-rev --name-only $head`; -chomp $branch; - -if ( $flag && "$branch" ne "debian" ) { - # We create a cabal sandbox so that Emacs' haskell-mode ignores - # stack.yaml. We don't need to use stack because Propellor's deps - # are always installed as system packages - unless ( -d ".cabal-sandbox" ) { - system "cabal sandbox init"; - } - open my $fh, ">", ".dir-locals.el"; - print $fh <<'END'; -((nil . ((indent-tabs-mode . t) - (tab-width . 8) - (fill-column . 80))) - ;; Warn about spaces used for indentation: - (haskell-mode . ((eval . (highlight-regexp "^ +"))))) -END - close $fh; -} -- cgit v1.2.3