diff options
author | Adam Roben <adam@roben.org> | 2012-06-07 09:50:19 -0400 |
---|---|---|
committer | Adam Roben <adam@roben.org> | 2012-06-07 09:50:19 -0400 |
commit | 8e60c712acef798a6b3913359f8d9dffcddf7256 (patch) | |
tree | 111d5cfc0e23bceb4a097a369d29c2992255fa37 /tests-clar/diff/iterator.c | |
parent | b9f78cb87b7a8cb07a660dacdcb59c9adf733c3f (diff) | |
download | libgit2-8e60c712acef798a6b3913359f8d9dffcddf7256.tar.gz |
Fix git_status_file for files that start with a character > 0x7f8bit-filename-status
git_status_file would always return GIT_ENOTFOUND for these files.
The underlying bug was that git__strcmp_cb, which is used by
git_path_with_stat_cmp to sort entries in the working directory,
compares strings based on unsigned chars (this is confirmed by the
strcmp(3) manpage), while git__prefixcmp, which is used by
workdir_iterator__entry_cmp to search for a path in the working
directory, compares strings based on char. So the sort puts this path at
the end of the list, while the search expects it to be at the beginning.
The fix was simply to make git__prefixcmp compare using unsigned chars,
just like strcmp(3). The rest of the change is just adding/updating
tests.
Diffstat (limited to 'tests-clar/diff/iterator.c')
-rw-r--r-- | tests-clar/diff/iterator.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests-clar/diff/iterator.c b/tests-clar/diff/iterator.c index be29bea66..eee84810a 100644 --- a/tests-clar/diff/iterator.c +++ b/tests-clar/diff/iterator.c @@ -474,13 +474,14 @@ static const char *status_paths[] = { "subdir/current_file", "subdir/modified_file", "subdir/new_file", + "\xe8\xbf\x99", NULL }; void test_diff_iterator__workdir_1(void) { workdir_iterator_test( - "status", NULL, NULL, 12, 1, status_paths, "ignored_file"); + "status", NULL, NULL, 13, 1, status_paths, "ignored_file"); } static const char *status_paths_range_0[] = { @@ -527,13 +528,14 @@ static const char *status_paths_range_4[] = { "subdir/current_file", "subdir/modified_file", "subdir/new_file", + "\xe8\xbf\x99", NULL }; void test_diff_iterator__workdir_1_ranged_4(void) { workdir_iterator_test( - "status", "subdir/", NULL, 3, 0, status_paths_range_4, NULL); + "status", "subdir/", NULL, 4, 0, status_paths_range_4, NULL); } static const char *status_paths_range_5[] = { @@ -551,7 +553,7 @@ void test_diff_iterator__workdir_1_ranged_5(void) void test_diff_iterator__workdir_1_ranged_empty_0(void) { workdir_iterator_test( - "status", "z_does_not_exist", NULL, + "status", "\xff_does_not_exist", NULL, 0, 0, NULL, NULL); } |