t / t5002-archive-attr-pattern.shon commit Merge branch 'ap/maint-diff-rename-avoid-overlap' into maint (b76a9e1)
   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
  31        mkdir -p one-level-lower/two-levels-lower/ignored-only-if-dir &&
  32        echo ignored by ignored dir >one-level-lower/two-levels-lower/ignored-only-if-dir/ignored-by-ignored-dir &&
  33        git add one-level-lower &&
  34
  35        git commit -m. &&
  36
  37        git clone --bare . bare &&
  38        cp .git/info/attributes bare/info/attributes
  39'
  40
  41test_expect_success 'git archive' '
  42        git archive HEAD >archive.tar &&
  43        (mkdir archive && cd archive && "$TAR" xf -) <archive.tar
  44'
  45
  46test_expect_missing     archive/ignored
  47test_expect_missing     archive/not-ignored-dir/ignored
  48test_expect_exists      archive/not-ignored-dir/ignored-only-if-dir
  49test_expect_exists      archive/not-ignored-dir/
  50test_expect_missing     archive/ignored-only-if-dir/
  51test_expect_missing     archive/ignored-ony-if-dir/ignored-by-ignored-dir
  52test_expect_exists      archive/one-level-lower/
  53test_expect_missing     archive/one-level-lower/two-levels-lower/ignored-only-if-dir/
  54test_expect_missing     archive/one-level-lower/two-levels-lower/ignored-ony-if-dir/ignored-by-ignored-dir
  55
  56
  57test_done