t / t2204-add-ignored.shon commit show: use streaming API for showing blobs (74775a0)
   1#!/bin/sh
   2
   3test_description='giving ignored paths to git add'
   4
   5. ./test-lib.sh
   6
   7test_expect_success setup '
   8        mkdir sub dir dir/sub &&
   9        echo sub >.gitignore &&
  10        echo ign >>.gitignore &&
  11        for p in . sub dir dir/sub
  12        do
  13                >"$p/ign" &&
  14                >"$p/file" || exit 1
  15        done
  16'
  17
  18for i in file dir/file dir 'd*'
  19do
  20        test_expect_success "no complaints for unignored $i" '
  21                rm -f .git/index &&
  22                git add "$i" &&
  23                git ls-files "$i" >out &&
  24                test -s out
  25        '
  26done
  27
  28for i in ign dir/ign dir/sub dir/sub/*ign sub/file sub sub/*
  29do
  30        test_expect_success "complaints for ignored $i" '
  31                rm -f .git/index &&
  32                test_must_fail git add "$i" 2>err &&
  33                git ls-files "$i" >out &&
  34                ! test -s out
  35        '
  36
  37        test_expect_success "complaints for ignored $i output" '
  38                test_i18ngrep -e "Use -f if" err
  39        '
  40
  41        test_expect_success "complaints for ignored $i with unignored file" '
  42                rm -f .git/index &&
  43                test_must_fail git add "$i" file 2>err &&
  44                git ls-files "$i" >out &&
  45                ! test -s out
  46        '
  47        test_expect_success "complaints for ignored $i with unignored file output" '
  48                test_i18ngrep -e "Use -f if" err
  49        '
  50done
  51
  52for i in sub sub/*
  53do
  54        test_expect_success "complaints for ignored $i in dir" '
  55                rm -f .git/index &&
  56                (
  57                        cd dir &&
  58                        test_must_fail git add "$i" 2>err &&
  59                        git ls-files "$i" >out &&
  60                        ! test -s out
  61                )
  62        '
  63
  64        test_expect_success "complaints for ignored $i in dir output" '
  65                (
  66                        cd dir &&
  67                        test_i18ngrep -e "Use -f if" err
  68                )
  69        '
  70done
  71
  72for i in ign file
  73do
  74        test_expect_success "complaints for ignored $i in sub" '
  75                rm -f .git/index &&
  76                (
  77                        cd sub &&
  78                        test_must_fail git add "$i" 2>err &&
  79                        git ls-files "$i" >out &&
  80                        ! test -s out
  81                )
  82        '
  83
  84        test_expect_success "complaints for ignored $i in sub output" '
  85                (
  86                        cd sub &&
  87                        test_i18ngrep -e "Use -f if" err
  88                )
  89        '
  90done
  91
  92test_done