t6036: avoid non-portable "cp -a"
[gitweb.git] / t / t6300-for-each-ref.sh
index e0496da812f34df16ef7c3417788f9096ddc1e0f..97bfbee6e8d69e46bd1ef1c94dae32d64be977b2 100755 (executable)
@@ -715,6 +715,29 @@ test_expect_success 'basic atom: head contents:trailers' '
        test_cmp expect actual.clean
 '
 
+test_expect_success 'trailer parsing not fooled by --- line' '
+       git commit --allow-empty -F - <<-\EOF &&
+       this is the subject
+
+       This is the body. The message has a "---" line which would confuse a
+       message+patch parser. But here we know we have only a commit message,
+       so we get it right.
+
+       trailer: wrong
+       ---
+       This is more body.
+
+       trailer: right
+       EOF
+
+       {
+               echo "trailer: right" &&
+               echo
+       } >expect &&
+       git for-each-ref --format="%(trailers)" refs/heads/master >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'Add symbolic ref for the following tests' '
        git symbolic-ref refs/heads/sym refs/heads/master
 '
@@ -796,9 +819,8 @@ test_expect_success ':remotename and :remoteref' '
 '
 
 test_expect_success 'for-each-ref --ignore-case ignores case' '
-       >expect &&
        git for-each-ref --format="%(refname)" refs/heads/MASTER >actual &&
-       test_cmp expect actual &&
+       test_must_be_empty actual &&
 
        echo refs/heads/master >expect &&
        git for-each-ref --format="%(refname)" --ignore-case \