t / t0003-attributes.shon commit Merge branch 'maint' (d9f39d9)
   1#!/bin/sh
   2
   3test_description=gitattributes
   4
   5. ./test-lib.sh
   6
   7attr_check () {
   8
   9        path="$1"
  10        expect="$2"
  11
  12        git check-attr test -- "$path" >actual &&
  13        echo "$path: test: $2" >expect &&
  14        test_cmp expect actual
  15
  16}
  17
  18
  19test_expect_success 'setup' '
  20
  21        mkdir -p a/b/d a/c &&
  22        (
  23                echo "f test=f"
  24        ) >.gitattributes &&
  25        (
  26                echo "g test=a/g" &&
  27                echo "b/g test=a/b/g"
  28        ) >a/.gitattributes &&
  29        (
  30                echo "h test=a/b/h" &&
  31                echo "d/* test=a/b/d/*"
  32        ) >a/b/.gitattributes
  33
  34'
  35
  36test_expect_success 'attribute test' '
  37
  38        attr_check f f &&
  39        attr_check a/f f &&
  40        attr_check a/c/f f &&
  41        attr_check a/g a/g &&
  42        attr_check a/b/g a/b/g &&
  43        attr_check b/g unspecified &&
  44        attr_check a/b/h a/b/h &&
  45        attr_check a/b/d/g "a/b/d/*"
  46
  47'
  48
  49test_done