Merge branch 'mb/fetch-call-a-non-branch-a-ref'
[gitweb.git] / t / t6006-rev-list-format.sh
index e8fde5c19c16f3fa2305ed319edb3289f4f758b9..a01d2445022ecb82fe0e31739527339fa02e44a5 100755 (executable)
@@ -101,6 +101,15 @@ commit 131a310eb913d107dd3c09a65d1651175898735d
 commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873
 EOF
 
+test_format raw-body %B <<'EOF'
+commit 131a310eb913d107dd3c09a65d1651175898735d
+changed foo
+
+commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873
+added foo
+
+EOF
+
 test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'
 commit 131a310eb913d107dd3c09a65d1651175898735d
 \e[31mfoo\e[32mbar\e[34mbaz\e[mxyzzy
@@ -153,6 +162,14 @@ commit 131a310eb913d107dd3c09a65d1651175898735d
 commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873
 EOF
 
+test_expect_success '%x00 shows NUL' '
+       echo  >expect commit f58db70b055c5718631e5c61528b28b12090cdea &&
+       echo >>expect fooQbar &&
+       git rev-list -1 --format=foo%x00bar HEAD >actual.nul &&
+       nul_to_q <actual.nul >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success '%ad respects --date=' '
        echo 2005-04-07 >expect.ad-short &&
        git log -1 --date=short --pretty=tformat:%ad >output.ad-short master &&
@@ -171,26 +188,36 @@ test_expect_success 'empty email' '
 
 test_expect_success 'del LF before empty (1)' '
        git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD^^ >actual &&
-       test $(wc -l <actual) = 2
+       test_line_count = 2 actual
 '
 
 test_expect_success 'del LF before empty (2)' '
        git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD >actual &&
-       test $(wc -l <actual) = 6 &&
+       test_line_count = 6 actual &&
        grep "^$" actual
 '
 
 test_expect_success 'add LF before non-empty (1)' '
        git show -s --pretty=format:"%s%+b%nThanks%n" HEAD^^ >actual &&
-       test $(wc -l <actual) = 2
+       test_line_count = 2 actual
 '
 
 test_expect_success 'add LF before non-empty (2)' '
        git show -s --pretty=format:"%s%+b%nThanks%n" HEAD >actual &&
-       test $(wc -l <actual) = 6 &&
+       test_line_count = 6 actual &&
        grep "^$" actual
 '
 
+test_expect_success 'add SP before non-empty (1)' '
+       git show -s --pretty=format:"%s% bThanks" HEAD^^ >actual &&
+       test $(wc -w <actual) = 2
+'
+
+test_expect_success 'add SP before non-empty (2)' '
+       git show -s --pretty=format:"%s% sThanks" HEAD^^ >actual &&
+       test $(wc -w <actual) = 4
+'
+
 test_expect_success '--abbrev' '
        echo SHORT SHORT SHORT >expect2 &&
        echo LONG LONG LONG >expect3 &&
@@ -240,13 +267,20 @@ test_expect_success '%gd shortens ref name' '
        test_cmp expect.gd-short actual.gd-short
 '
 
+test_expect_success 'reflog identity' '
+       echo "C O Mitter:committer@example.com" >expect &&
+       git log -g -1 --format="%gn:%ge" >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'oneline with empty message' '
        git commit -m "dummy" --allow-empty &&
        git commit -m "dummy" --allow-empty &&
        git filter-branch --msg-filter "sed -e s/dummy//" HEAD^^.. &&
        git rev-list --oneline HEAD >test.txt &&
-       test $(git rev-list --oneline HEAD | wc -l) -eq 5 &&
-       test $(git rev-list --oneline --graph HEAD | wc -l) -eq 5
+       test_line_count = 5 test.txt &&
+       git rev-list --oneline --graph HEAD >testg.txt &&
+       test_line_count = 5 testg.txt
 '
 
 test_done