t / t5002-archive-attr-pattern.shon commit Merge branch 'jk/ui-color-always-to-auto-maint' into jk/ui-color-always-to-auto (aebd235)
   1#!/bin/sh
   2
   3test_description='git archive attribute pattern tests'
   4
   5. ./test-lib.sh
   6
   7test_expect_exists() {
   8        test_expect_success " $1 exists" "test -e $1"
   9}
  10
  11test_expect_missing() {
  12        test_expect_success " $1 does not exist" "test ! -e $1"
  13}
  14
  15test_expect_success 'setup' '
  16        echo ignored >ignored &&
  17        echo ignored export-ignore >>.git/info/attributes &&
  18        git add ignored &&
  19
  20        mkdir not-ignored-dir &&
  21        echo ignored-in-tree >not-ignored-dir/ignored &&
  22        echo not-ignored-in-tree >not-ignored-dir/ignored-only-if-dir &&
  23        git add not-ignored-dir &&
  24
  25        mkdir ignored-only-if-dir &&
  26        echo ignored by ignored dir >ignored-only-if-dir/ignored-by-ignored-dir &&
  27        echo ignored-only-if-dir/ export-ignore >>.git/info/attributes &&
  28        git add ignored-only-if-dir &&
  29
  30        mkdir -p ignored-without-slash &&
  31        echo "ignored without slash" >ignored-without-slash/foo &&
  32        git add ignored-without-slash/foo &&
  33        echo "ignored-without-slash export-ignore" >>.git/info/attributes &&
  34
  35        mkdir -p wildcard-without-slash &&
  36        echo "ignored without slash" >wildcard-without-slash/foo &&
  37        git add wildcard-without-slash/foo &&
  38        echo "wild*-without-slash export-ignore" >>.git/info/attributes &&
  39
  40        mkdir -p deep/and/slashless &&
  41        echo "ignored without slash" >deep/and/slashless/foo &&
  42        git add deep/and/slashless/foo &&
  43        echo "deep/and/slashless export-ignore" >>.git/info/attributes &&
  44
  45        mkdir -p deep/with/wildcard &&
  46        echo "ignored without slash" >deep/with/wildcard/foo &&
  47        git add deep/with/wildcard/foo &&
  48        echo "deep/*t*/wildcard export-ignore" >>.git/info/attributes &&
  49
  50        mkdir -p one-level-lower/two-levels-lower/ignored-only-if-dir &&
  51        echo ignored by ignored dir >one-level-lower/two-levels-lower/ignored-only-if-dir/ignored-by-ignored-dir &&
  52        git add one-level-lower &&
  53
  54        git commit -m. &&
  55
  56        git clone --bare . bare &&
  57        cp .git/info/attributes bare/info/attributes
  58'
  59
  60test_expect_success 'git archive' '
  61        git archive HEAD >archive.tar &&
  62        (mkdir archive && cd archive && "$TAR" xf -) <archive.tar
  63'
  64
  65test_expect_missing     archive/ignored
  66test_expect_missing     archive/not-ignored-dir/ignored
  67test_expect_exists      archive/not-ignored-dir/ignored-only-if-dir
  68test_expect_exists      archive/not-ignored-dir/
  69test_expect_missing     archive/ignored-only-if-dir/
  70test_expect_missing     archive/ignored-ony-if-dir/ignored-by-ignored-dir
  71test_expect_missing     archive/ignored-without-slash/ &&
  72test_expect_missing     archive/ignored-without-slash/foo &&
  73test_expect_missing     archive/wildcard-without-slash/
  74test_expect_missing     archive/wildcard-without-slash/foo &&
  75test_expect_missing     archive/deep/and/slashless/ &&
  76test_expect_missing     archive/deep/and/slashless/foo &&
  77test_expect_missing     archive/deep/with/wildcard/ &&
  78test_expect_missing     archive/deep/with/wildcard/foo &&
  79test_expect_missing     archive/one-level-lower/
  80test_expect_missing     archive/one-level-lower/two-levels-lower/ignored-only-if-dir/
  81test_expect_missing     archive/one-level-lower/two-levels-lower/ignored-ony-if-dir/ignored-by-ignored-dir
  82
  83
  84test_done