diff options
Diffstat (limited to 'hooks/git/propellor/post-checkout')
-rwxr-xr-x | hooks/git/propellor/post-checkout | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/hooks/git/propellor/post-checkout b/hooks/git/propellor/post-checkout new file mode 100755 index 00000000..5118e81a --- /dev/null +++ b/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; +} |