summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorAdam Roben <adam@roben.org>2012-06-07 09:50:19 -0400
committerAdam Roben <adam@roben.org>2012-06-07 09:50:19 -0400
commit8e60c712acef798a6b3913359f8d9dffcddf7256 (patch)
tree111d5cfc0e23bceb4a097a369d29c2992255fa37 /src/util.c
parentb9f78cb87b7a8cb07a660dacdcb59c9adf733c3f (diff)
downloadlibgit2-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 'src/util.c')
-rw-r--r--src/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index ce770203a..3093cd767 100644
--- a/src/util.c
+++ b/src/util.c
@@ -179,7 +179,7 @@ void git__strtolower(char *str)
int git__prefixcmp(const char *str, const char *prefix)
{
for (;;) {
- char p = *(prefix++), s;
+ unsigned char p = *(prefix++), s;
if (!p)
return 0;
if ((s = *(str++)) != p)