Merge branch 'ee/clean-test-fixes' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 4 Sep 2015 02:18:05 +0000 (19:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Sep 2015 02:18:05 +0000 (19:18 -0700)
* ee/clean-test-fixes:
t7300: fix broken && chains

1  2 
t/t7300-clean.sh
diff --combined t/t7300-clean.sh
index 99be5d95d063f85873a4cb5c5c7ebefd8ebfc990,954ec9c71ea2e1d53fd6cf670870d8e5cacaf094..634808a708588896f2e6ffbc1e2e28575409b0eb
@@@ -119,7 -119,10 +119,7 @@@ test_expect_success C_LOCALE_OUTPUT 'gi
                git clean -n ../src |
                sed -n -e "s|^Would remove ||p"
        ) &&
 -      test "$would_clean" = ../src/part3.c || {
 -              echo "OOps <$would_clean>"
 -              false
 -      }
 +      verbose test "$would_clean" = ../src/part3.c
  '
  
  test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
                git clean -n "$(pwd)/../src" |
                sed -n -e "s|^Would remove ||p"
        ) &&
 -      test "$would_clean" = ../src/part3.c || {
 -              echo "OOps <$would_clean>"
 -              false
 -      }
 +      verbose test "$would_clean" = ../src/part3.c
  '
  
  test_expect_success 'git clean with out of work tree relative path' '
@@@ -292,23 -298,6 +292,23 @@@ test_expect_success 'git clean -d -x' 
  
  '
  
 +test_expect_success 'git clean -d -x with ignored tracked directory' '
 +
 +      mkdir -p build docs &&
 +      touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
 +      git clean -d -x -e src &&
 +      test -f Makefile &&
 +      test -f README &&
 +      test -f src/part1.c &&
 +      test -f src/part2.c &&
 +      test ! -f a.out &&
 +      test -f src/part3.c &&
 +      test ! -d docs &&
 +      test ! -f obj.o &&
 +      test ! -d build
 +
 +'
 +
  test_expect_success 'git clean -X' '
  
        mkdir -p build docs &&
@@@ -343,23 -332,6 +343,23 @@@ test_expect_success 'git clean -d -X' 
  
  '
  
 +test_expect_success 'git clean -d -X with ignored tracked directory' '
 +
 +      mkdir -p build docs &&
 +      touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
 +      git clean -d -X -e src &&
 +      test -f Makefile &&
 +      test -f README &&
 +      test -f src/part1.c &&
 +      test -f src/part2.c &&
 +      test -f a.out &&
 +      test ! -f src/part3.c &&
 +      test -f docs/manual.txt &&
 +      test ! -f obj.o &&
 +      test ! -d build
 +
 +'
 +
  test_expect_success 'clean.requireForce defaults to true' '
  
        git config --unset clean.requireForce &&
@@@ -420,10 -392,10 +420,10 @@@ test_expect_success SANITY 'removal fai
  
        mkdir foo &&
        touch foo/bar &&
 +      test_when_finished "chmod 755 foo" &&
        (exec <foo/bar &&
         chmod 0 foo &&
 -       test_must_fail git clean -f -d &&
 -       chmod 755 foo)
 +       test_must_fail git clean -f -d)
  '
  
  test_expect_success 'nested git work tree' '
        (
                cd foo &&
                git init &&
-               >hello.world
-               git add . &&
-               git commit -a -m nested
+               test_commit nested hello.world
        ) &&
        (
                cd bar &&
        (
                cd baz/boo &&
                git init &&
-               >deeper.world
-               git add . &&
-               git commit -a -m deeply.nested
+               test_commit deeply.nested deeper.world
        ) &&
        git clean -f -d &&
        test -f foo/.git/index &&
@@@ -461,9 -429,7 +457,7 @@@ test_expect_success 'force removal of n
        (
                cd foo &&
                git init &&
-               >hello.world
-               git add . &&
-               git commit -a -m nested
+               test_commit nested hello.world
        ) &&
        (
                cd bar &&
        (
                cd baz/boo &&
                git init &&
-               >deeper.world
-               git add . &&
-               git commit -a -m deeply.nested
+               test_commit deeply.nested deeper.world
        ) &&
        git clean -f -f -d &&
        ! test -d foo &&
@@@ -505,20 -469,4 +497,20 @@@ test_expect_success SANITY 'git clean -
        ! test -d foo
  '
  
 +test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' '
 +      mkdir -p foo &&
 +      mkdir -p foobar &&
 +      git clean -df foobar &&
 +      test_path_is_dir foo &&
 +      test_path_is_missing foobar
 +'
 +
 +test_expect_success 'git clean -d respects pathspecs (pathspec is prefix of dir)' '
 +      mkdir -p foo &&
 +      mkdir -p foobar &&
 +      git clean -df foo &&
 +      test_path_is_missing foo &&
 +      test_path_is_dir foobar
 +'
 +
  test_done