Commit graph

2 commits

Author SHA1 Message Date
Jeff King 82ebb0b6ec add test_cmp function for test scripts
Many scripts compare actual and expected output using
"diff -u". This is nicer than "cmp" because the output shows
how the two differ. However, not all versions of diff
understand -u, leading to unnecessary test failure.

This adds a test_cmp function to the test scripts and
switches all "diff -u" invocations to use it. The function
uses the contents of "$GIT_TEST_CMP" to compare its
arguments; the default is "diff -u".

On systems with a less-capable diff, you can do:

  GIT_TEST_CMP=cmp make test

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-13 00:57:52 -07:00
Junio C Hamano 23707811c5 diff: do not chomp hunk-header in the middle of a character
We truncate hunk-header line at 80 bytes, but that 80th byte
could be in the middle of a character, which is bad.  This uses
pick_one_utf8_char() function to make sure we do not cut a character
in the middle.

This assumes that the internal representation of the text is
UTF-8.  This needs to be extended in the future but the optimal
direction has not been decided yet.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-06 22:44:44 -08:00