Merge branch 'rw/apply-does-not-take-ignore-date' into maint
[gitweb.git] / t / t4010-diff-pathspec.sh
index 589bc6bfb4543324dcf6f166c4db482958f26e63..bf078418662c4bab4e512be8fc22a5aa76466119 100755 (executable)
@@ -18,7 +18,7 @@ test_expect_success \
      mkdir path1 &&
      echo rezrov >path1/file1 &&
      git update-index --add file0 path1/file1 &&
-     tree=`git write-tree` &&
+     tree=$(git write-tree) &&
      echo "$tree" &&
      echo nitfol >file0 &&
      echo yomin >path1/file1 &&
@@ -110,11 +110,28 @@ test_expect_success 'diff-tree -r with wildcard' '
        test_cmp expected result
 '
 
+test_expect_success 'setup submodules' '
+       test_tick &&
+       git init submod &&
+       ( cd submod && test_commit first; ) &&
+       git add submod &&
+       git commit -m first &&
+       ( cd submod && test_commit second; ) &&
+       git add submod &&
+       git commit -m second
+'
+
+test_expect_success 'diff-tree ignores trailing slash on submodule path' '
+       git diff --name-only HEAD^ HEAD submod >expect &&
+       git diff --name-only HEAD^ HEAD submod/ >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'diff multiple wildcard pathspecs' '
        mkdir path2 &&
        echo rezrov >path2/file1 &&
        git update-index --add path2/file1 &&
-       tree3=`git write-tree` &&
+       tree3=$(git write-tree) &&
        git diff --name-only $tree $tree3 -- "path2*1" "path1*1" >actual &&
        cat <<-\EOF >expect &&
        path1/file1
@@ -123,4 +140,10 @@ test_expect_success 'diff multiple wildcard pathspecs' '
        test_cmp expect actual
 '
 
+test_expect_success 'diff-cache ignores trailing slash on submodule path' '
+       git diff --name-only HEAD^ submod >expect &&
+       git diff --name-only HEAD^ submod/ >actual &&
+       test_cmp expect actual
+'
+
 test_done