Code

Don't use "<unknown>" for placeholders and suppress printing of empty user formats.
[git.git] / t / t3700-add.sh
index b52fde8577185adf962b70ad16efbcb7bfe46042..a328bf57eb67fd96a88020f02948d380ec699496 100755 (executable)
@@ -131,8 +131,8 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st
        (
                echo "100644 $(git hash-object -w stage1) 1     file"
                echo "100755 $(git hash-object -w stage2) 2     file"
-               echo "100644 $(printf $s | git hash-object -w -t blob --stdin) 1        symlink"
-               echo "120000 $(printf $s | git hash-object -w -t blob --stdin) 2        symlink"
+               echo "100644 $(printf 1 | git hash-object -w -t blob --stdin) 1 symlink"
+               echo "120000 $(printf 2 | git hash-object -w -t blob --stdin) 2 symlink"
        ) | git update-index --index-info &&
        git config core.filemode 0 &&
        git config core.symlinks 0 &&
@@ -143,4 +143,16 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st
        git ls-files --stage | grep "^120000 .* 0       symlink$"
 '
 
+test_expect_success 'git add --refresh' '
+       >foo && git add foo && git commit -a -m "commit all" &&
+       test -z "`git diff-index HEAD -- foo`" &&
+       git read-tree HEAD &&
+       case "`git diff-index HEAD -- foo`" in
+       :100644" "*"M   foo") echo ok;;
+       *) echo fail; (exit 1);;
+       esac &&
+       git add --refresh -- foo &&
+       test -z "`git diff-index HEAD -- foo`"
+'
+
 test_done