Skip to content

Commit

Permalink
test: use test_i18ncmp when checking --stat output
Browse files Browse the repository at this point in the history
Ever since v1.7.9.2~13 (2012-02-01), git's diffstat-style summary line
produced by "git apply --stat", "git diff --stat", and "git commit"
varies by locale, producing test failures when GETTEXT_POISON is set.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
jrn authored and gitster committed Mar 13, 2012
1 parent fa678fe commit fc5877a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions t/t3300-funny-names.sh
Expand Up @@ -174,7 +174,7 @@ EOF
test_expect_success TABS_IN_FILENAMES 'git diff-tree rename with-funny applied' \ test_expect_success TABS_IN_FILENAMES 'git diff-tree rename with-funny applied' \
'git diff-index -M -p $t0 | 'git diff-index -M -p $t0 |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
test_cmp expected current' test_i18ncmp expected current'


test_expect_success TABS_IN_FILENAMES 'setup expect' ' test_expect_success TABS_IN_FILENAMES 'setup expect' '
cat > expected <<\EOF cat > expected <<\EOF
Expand All @@ -187,12 +187,12 @@ EOF
test_expect_success TABS_IN_FILENAMES 'git diff-tree delete with-funny applied' \ test_expect_success TABS_IN_FILENAMES 'git diff-tree delete with-funny applied' \
'git diff-index -p $t0 | 'git diff-index -p $t0 |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
test_cmp expected current' test_i18ncmp expected current'


test_expect_success TABS_IN_FILENAMES 'git apply non-git diff' \ test_expect_success TABS_IN_FILENAMES 'git apply non-git diff' \
'git diff-index -p $t0 | 'git diff-index -p $t0 |
sed -ne "/^[-+@]/p" | sed -ne "/^[-+@]/p" |
git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
test_cmp expected current' test_i18ncmp expected current'


test_done test_done
4 changes: 2 additions & 2 deletions t/t3508-cherry-pick-many-commits.sh
Expand Up @@ -55,7 +55,7 @@ test_expect_success 'cherry-pick first..fourth works' '
git diff --quiet HEAD other && git diff --quiet HEAD other &&
sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy && sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
test_cmp expected actual.fuzzy && test_i18ncmp expected actual.fuzzy &&
check_head_differs_from fourth check_head_differs_from fourth
' '


Expand All @@ -82,7 +82,7 @@ test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
git diff --quiet other && git diff --quiet other &&
git diff --quiet HEAD other && git diff --quiet HEAD other &&
sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy && sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
test_cmp expected actual.fuzzy && test_i18ncmp expected actual.fuzzy &&
check_head_differs_from fourth check_head_differs_from fourth
' '


Expand Down
4 changes: 2 additions & 2 deletions t/t3903-stash.sh
Expand Up @@ -447,7 +447,7 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
EOF EOF
git stash show ${STASH_ID} >actual && git stash show ${STASH_ID} >actual &&
test_cmp expected actual test_i18ncmp expected actual
' '


test_expect_success 'stash show -p - stashes on stack, stash-like argument' ' test_expect_success 'stash show -p - stashes on stack, stash-like argument' '
Expand Down Expand Up @@ -485,7 +485,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
EOF EOF
git stash show ${STASH_ID} >actual && git stash show ${STASH_ID} >actual &&
test_cmp expected actual test_i18ncmp expected actual
' '


test_expect_success 'stash show -p - no stashes on stack, stash-like argument' ' test_expect_success 'stash show -p - no stashes on stack, stash-like argument' '
Expand Down
4 changes: 2 additions & 2 deletions t/t4012-diff-binary.sh
Expand Up @@ -25,11 +25,11 @@ cat > expected <<\EOF
EOF EOF
test_expect_success 'diff without --binary' \ test_expect_success 'diff without --binary' \
'git diff | git apply --stat --summary >current && 'git diff | git apply --stat --summary >current &&
test_cmp expected current' test_i18ncmp expected current'


test_expect_success 'diff with --binary' \ test_expect_success 'diff with --binary' \
'git diff --binary | git apply --stat --summary >current && 'git diff --binary | git apply --stat --summary >current &&
test_cmp expected current' test_i18ncmp expected current'


# apply needs to be able to skip the binary material correctly # apply needs to be able to skip the binary material correctly
# in order to report the line number of a corrupt patch. # in order to report the line number of a corrupt patch.
Expand Down
2 changes: 1 addition & 1 deletion t/t4049-diff-stat-count.sh
Expand Up @@ -19,7 +19,7 @@ test_expect_success setup '
2 files changed, 2 insertions(+) 2 files changed, 2 insertions(+)
EOF EOF
git diff --stat --stat-count=2 >actual && git diff --stat --stat-count=2 >actual &&
test_cmp expect actual test_i18ncmp expect actual
' '


test_done test_done
4 changes: 2 additions & 2 deletions t/t4100-apply-stat.sh
Expand Up @@ -17,13 +17,13 @@ do
test_expect_success "$title" ' test_expect_success "$title" '
git apply --stat --summary \ git apply --stat --summary \
<"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current && <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current &&
test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current test_i18ncmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
' '


test_expect_success "$title with recount" ' test_expect_success "$title with recount" '
sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" | sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" |
git apply --recount --stat --summary >current && git apply --recount --stat --summary >current &&
test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current test_i18ncmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current
' '
done <<\EOF done <<\EOF
rename rename
Expand Down
2 changes: 1 addition & 1 deletion t/t5150-request-pull.sh
Expand Up @@ -216,7 +216,7 @@ test_expect_success 'pull request format' '
git request-pull initial "$downstream_url" >../request git request-pull initial "$downstream_url" >../request
) && ) &&
<request sed -nf fuzz.sed >request.fuzzy && <request sed -nf fuzz.sed >request.fuzzy &&
test_cmp expect request.fuzzy test_i18ncmp expect request.fuzzy
' '


Expand Down
6 changes: 3 additions & 3 deletions t/t7602-merge-octopus-many.sh
Expand Up @@ -66,7 +66,7 @@ EOF
test_expect_success 'merge output uses pretty names' ' test_expect_success 'merge output uses pretty names' '
git reset --hard c1 && git reset --hard c1 &&
git merge c2 c3 c4 >actual && git merge c2 c3 c4 >actual &&
test_cmp actual expected test_i18ncmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
Expand All @@ -80,7 +80,7 @@ EOF


test_expect_success 'merge up-to-date output uses pretty names' ' test_expect_success 'merge up-to-date output uses pretty names' '
git merge c4 c5 >actual && git merge c4 c5 >actual &&
test_cmp actual expected test_i18ncmp expected actual
' '


cat >expected <<\EOF cat >expected <<\EOF
Expand All @@ -97,7 +97,7 @@ EOF
test_expect_success 'merge fast-forward output uses pretty names' ' test_expect_success 'merge fast-forward output uses pretty names' '
git reset --hard c0 && git reset --hard c0 &&
git merge c1 c2 >actual && git merge c1 c2 >actual &&
test_cmp actual expected test_i18ncmp expected actual
' '


test_done test_done

0 comments on commit fc5877a

Please sign in to comment.