Code

Merge remote branch 'ko/master' into jc/read-tree-cache-tree-fix
[git.git] / t / t1001-read-tree-m-2way.sh
index c2d408b46120ef9d962272b652a68a83ba0852a5..0c562bb820cb747a8f0d0df1eabb39da0b9eea21 100755 (executable)
@@ -26,8 +26,6 @@ read_tree_twoway () {
     git read-tree -m "$1" "$2" && git ls-files --stage
 }
 
-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
-_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
 compare_change () {
        sed -n >current \
            -e '/^--- /d; /^+++ /d; /^@@ /d;' \
@@ -392,4 +390,20 @@ test_expect_success \
      git ls-files --stage | tee >treeMcheck.out &&
      test_cmp treeM.out treeMcheck.out'
 
+test_expect_success '-m references the correct modified tree' '
+       echo >file-a &&
+       echo >file-b &&
+       git add file-a file-b &&
+       git commit -a -m "test for correct modified tree"
+       git branch initial-mod &&
+       echo b >file-b &&
+       git commit -a -m "B" &&
+       echo a >file-a &&
+       git add file-a &&
+       git ls-tree $(git write-tree) file-a >expect &&
+       git read-tree -m HEAD initial-mod &&
+       git ls-tree $(git write-tree) file-a >actual &&
+       test_cmp expect actual
+'
+
 test_done