rebase: add a config option to default to --reschedule-failed-exec
[gitweb.git] / t / t2203-add-intent.sh
index 546fead6ad31460af1e22d3c6400ad3825b1700f..68e54d5c4420092e481ae1324d419f5e5ec0c8ab 100755 (executable)
@@ -27,12 +27,12 @@ test_expect_success 'git status' '
 
 test_expect_success 'git status with porcelain v2' '
        git status --porcelain=v2 | grep -v "^?" >actual &&
-       nam1=d00491fd7e5bb6fa28c517a0bb32b8b506539d4d &&
-       nam2=ce013625030ba8dba906f756967f9e9ca394464a &&
+       nam1=$(echo 1 | git hash-object --stdin) &&
+       nam2=$(git hash-object elif) &&
        cat >expect <<-EOF &&
-       1 DA N... 100644 000000 100644 $nam1 $_z40 1.t
-       1 A. N... 000000 100644 100644 $_z40 $nam2 elif
-       1 .A N... 000000 000000 100644 $_z40 $_z40 file
+       1 DA N... 100644 000000 100644 $nam1 $ZERO_OID 1.t
+       1 A. N... 000000 100644 100644 $ZERO_OID $nam2 elif
+       1 .A N... 000000 000000 100644 $ZERO_OID $ZERO_OID file
        EOF
        test_cmp expect actual
 '
@@ -180,7 +180,7 @@ test_expect_success 'rename detection finds the right names' '
                EOF
                test_cmp expected.2 actual.2 &&
 
-               hash=12f00e90b6ef79117ce6e650416b8cf517099b78 &&
+               hash=$(git hash-object third) &&
                git status --porcelain=v2 | grep -v "^?" >actual.3 &&
                cat >expected.3 <<-EOF &&
                2 .R N... 100644 100644 100644 $hash $hash R100 third   first
@@ -195,8 +195,7 @@ test_expect_success 'rename detection finds the right names' '
                test_cmp expected.4 actual.4 &&
 
                git diff --cached --stat >actual.5 &&
-               : >expected.5 &&
-               test_cmp expected.5 actual.5
+               test_must_be_empty actual.5
 
        )
 '
@@ -223,7 +222,7 @@ test_expect_success 'double rename detection in status' '
                EOF
                test_cmp expected.2 actual.2 &&
 
-               hash=12f00e90b6ef79117ce6e650416b8cf517099b78 &&
+               hash=$(git hash-object third) &&
                git status --porcelain=v2 | grep -v "^?" >actual.3 &&
                cat >expected.3 <<-EOF &&
                2 R. N... 100644 100644 100644 $hash $hash R100 second  first
@@ -241,10 +240,10 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' '
        echo " create mode 100644 new-ita" >expected &&
        test_cmp expected actual &&
        git diff --cached --summary >actual2 &&
-       : >expected2 &&
-       test_cmp expected2 actual2
+       test_must_be_empty actual2
 '
 
+
 test_expect_success '"diff HEAD" includes ita as new files' '
        git reset --hard &&
        echo new >new-ita &&
@@ -262,4 +261,16 @@ test_expect_success '"diff HEAD" includes ita as new files' '
        test_cmp expected actual
 '
 
+test_expect_success 'apply --intent-to-add' '
+       git reset --hard &&
+       echo new >new-ita &&
+       git add -N new-ita &&
+       git diff >expected &&
+       grep "new file" expected &&
+       git reset --hard &&
+       git apply --intent-to-add expected &&
+       git diff >actual &&
+       test_cmp expected actual
+'
+
 test_done