t / t7520-ignored-hook-warning.shon commit Merge branch 'ds/push-squelch-ambig-warning' (1373999)
   1#!/bin/sh
   2
   3test_description='ignored hook warning'
   4
   5. ./test-lib.sh
   6
   7test_expect_success setup '
   8        hookdir="$(git rev-parse --git-dir)/hooks" &&
   9        hook="$hookdir/pre-commit" &&
  10        mkdir -p "$hookdir" &&
  11        write_script "$hook" <<-\EOF
  12        exit 0
  13        EOF
  14'
  15
  16test_expect_success 'no warning if hook is not ignored' '
  17        git commit --allow-empty -m "more" 2>message &&
  18        test_i18ngrep ! -e "hook was ignored" message
  19'
  20
  21test_expect_success POSIXPERM 'warning if hook is ignored' '
  22        chmod -x "$hook" &&
  23        git commit --allow-empty -m "even more" 2>message &&
  24        test_i18ngrep -e "hook was ignored" message
  25'
  26
  27test_expect_success POSIXPERM 'no warning if advice.ignoredHook set to false' '
  28        test_config advice.ignoredHook false &&
  29        chmod -x "$hook" &&
  30        git commit --allow-empty -m "even more" 2>message &&
  31        test_i18ngrep ! -e "hook was ignored" message
  32'
  33
  34test_expect_success 'no warning if unset advice.ignoredHook and hook removed' '
  35        rm -f "$hook" &&
  36        test_unconfig advice.ignoredHook &&
  37        git commit --allow-empty -m "even more" 2>message &&
  38        test_i18ngrep ! -e "hook was ignored" message
  39'
  40
  41test_done