Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-14 08:43:00 +0400
committerRussell Belfer <rb@github.com>2013-09-17 20:31:46 +0400
commit37f9e4093999498a25641018da36245d6a7cb008 (patch)
tree988585339ebb477c619364c020002ad5960d48c8 /tests-clar/clar_libgit2.c
parent155fa2342d838bdb2aa873c95a42e091351bb69a (diff)
Some tests with ident and crlf filters
Fixed the filter order to match core Git, too. This test demonstrates an interesting behavior of core Git (which is totally reasonable and which libgit2 matches, although mostly by coincidence). If you use the ident filter and commit a file with a garbage ident in it, like '$Id: this is just garbage$' and then immediately do a 'git checkout-index' with the new file, Git will not consider the file out of date and will not overwrite the file with an updated $Id$. Libgit2 has the same behavior. If you remove the file and then do a checkout-index, it will be replaced with a filtered version that has injected the OID correctly.
Diffstat (limited to 'tests-clar/clar_libgit2.c')
-rw-r--r--tests-clar/clar_libgit2.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests-clar/clar_libgit2.c b/tests-clar/clar_libgit2.c
index 4cf682449..d7e28831f 100644
--- a/tests-clar/clar_libgit2.c
+++ b/tests-clar/clar_libgit2.c
@@ -455,8 +455,15 @@ void clar__assert_equal_file(
if (ignore_cr)
bytes = strip_cr_from_buf(buf, bytes);
- clar__assert(memcmp(expected_data, buf, bytes) == 0,
- file, line, "file content mismatch", path, 1);
+ if (memcmp(expected_data, buf, bytes) != 0) {
+ int pos;
+ for (pos = 0; pos < bytes && expected_data[pos] == buf[pos]; ++pos)
+ /* find differing byte offset */;
+ p_snprintf(
+ buf, sizeof(buf), "file content mismatch at byte %d",
+ (int)(total_bytes + pos));
+ clar__fail(file, line, buf, path, 1);
+ }
expected_data += bytes;
total_bytes += bytes;