diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-04-16 22:24:33 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-04-17 15:43:02 -0700 |
commit | b5b718a57dccc9411d9db41bede29918e207391d (patch) | |
tree | 99d5ffc2e789b88522a489af66213ec3db6fc316 /archive | |
parent | 2751f7b221bad998ac28fe5e3d239a5b52816101 (diff) | |
download | dotfiles-b5b718a57dccc9411d9db41bede29918e207391d.tar.gz |
archive propellor git hook
Diffstat (limited to 'archive')
-rwxr-xr-x | archive/hooks/git/propellor/post-checkout_01dirlocals | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/archive/hooks/git/propellor/post-checkout_01dirlocals b/archive/hooks/git/propellor/post-checkout_01dirlocals new file mode 100755 index 00000000..472868cf --- /dev/null +++ b/archive/hooks/git/propellor/post-checkout_01dirlocals @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Path::Class; +use autodie ":all"; + +(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; +} |