t / t2204-add-ignored.shon commit t6022: Add tests with both rename source & dest involved in D/F conflicts (588504b)
   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                grep -e "Use -f if" err &&
  36                cat err
  37        '
  38
  39        test_expect_success "complaints for ignored $i with unignored file" '
  40                rm -f .git/index &&
  41                test_must_fail git add "$i" file 2>err &&
  42                git ls-files "$i" >out &&
  43                ! test -s out &&
  44                grep -e "Use -f if" err &&
  45                cat err
  46        '
  47done
  48
  49for i in sub sub/*
  50do
  51        test_expect_success "complaints for ignored $i in dir" '
  52                rm -f .git/index &&
  53                (
  54                        cd dir &&
  55                        test_must_fail git add "$i" 2>err &&
  56                        git ls-files "$i" >out &&
  57                        ! test -s out &&
  58                        grep -e "Use -f if" err &&
  59                        cat err
  60                )
  61        '
  62done
  63
  64for i in ign file
  65do
  66        test_expect_success "complaints for ignored $i in sub" '
  67                rm -f .git/index &&
  68                (
  69                        cd sub &&
  70                        test_must_fail git add "$i" 2>err &&
  71                        git ls-files "$i" >out &&
  72                        ! test -s out &&
  73                        grep -e "Use -f if" err &&
  74                        cat err
  75                )
  76        '
  77done
  78
  79test_done