From 1fcc20aa493161f52e02952800fc29f1c3ee9033 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 26 Jun 2016 19:20:11 +0200 Subject: k 5 git-hooks: add option for branches --- krebs/5pkgs/git-hooks/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'krebs/5pkgs/git-hooks') diff --git a/krebs/5pkgs/git-hooks/default.nix b/krebs/5pkgs/git-hooks/default.nix index c8e8c8f53..6f2cb8b6a 100644 --- a/krebs/5pkgs/git-hooks/default.nix +++ b/krebs/5pkgs/git-hooks/default.nix @@ -8,13 +8,14 @@ let }; # TODO irc-announce should return a derivation - irc-announce = { nick, channel, server, port ? 6667, verbose ? false }: '' + irc-announce = { nick, channel, server, port ? 6667, verbose ? false, branches ? [] }: '' #! /bin/sh set -euf export PATH=${makeBinPath (with pkgs; [ coreutils git + gnugrep gnused ])} @@ -54,6 +55,12 @@ let h=$(echo $ref | sed 's:^refs/heads/::') + ${optionalString (branches != []) '' + if ! (echo "$h" | grep -qE "${concatStringsSep "|" branches}"); then + echo "we are not serving this branch: $h" + exit 0 + fi + ''} # empty_tree=$(git hash-object -t tree /dev/null) empty_tree=4b825dc6 -- cgit v1.2.3