mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-04 09:18:48 +00:00
Merge pull request #751 from libgit2/8bit-filename-status
git_status_file returns GIT_ENOTFOUND for "域名检测工具.exe" (and similarly named files)
This commit is contained in:
commit
9bc57e5671
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
/tests-clar/clar.h
|
||||
/tests-clar/clar_main.c
|
||||
/tests-clar/clar_main.c.rule
|
||||
/apidocs
|
||||
/trash-*.exe
|
||||
/libgit2.pc
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,12 @@ void test_diff_workdir__to_index(void)
|
||||
* - git diff
|
||||
* - mv .git .gitted
|
||||
*/
|
||||
cl_assert_equal_i(12, exp.files);
|
||||
cl_assert_equal_i(13, exp.files);
|
||||
cl_assert_equal_i(0, exp.file_adds);
|
||||
cl_assert_equal_i(4, exp.file_dels);
|
||||
cl_assert_equal_i(4, exp.file_mods);
|
||||
cl_assert_equal_i(1, exp.file_ignored);
|
||||
cl_assert_equal_i(3, exp.file_untracked);
|
||||
cl_assert_equal_i(4, exp.file_untracked);
|
||||
|
||||
cl_assert_equal_i(8, exp.hunks);
|
||||
|
||||
@ -87,12 +87,12 @@ void test_diff_workdir__to_tree(void)
|
||||
cl_git_pass(git_diff_foreach(
|
||||
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
|
||||
|
||||
cl_assert(exp.files == 13);
|
||||
cl_assert(exp.files == 14);
|
||||
cl_assert(exp.file_adds == 0);
|
||||
cl_assert(exp.file_dels == 4);
|
||||
cl_assert(exp.file_mods == 4);
|
||||
cl_assert(exp.file_ignored == 1);
|
||||
cl_assert(exp.file_untracked == 4);
|
||||
cl_assert(exp.file_untracked == 5);
|
||||
|
||||
/* Since there is no git diff equivalent, let's just assume that the
|
||||
* text diffs produced by git_diff_foreach are accurate here. We will
|
||||
@ -115,12 +115,12 @@ void test_diff_workdir__to_tree(void)
|
||||
cl_git_pass(git_diff_foreach(
|
||||
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
|
||||
|
||||
cl_assert(exp.files == 14);
|
||||
cl_assert(exp.files == 15);
|
||||
cl_assert(exp.file_adds == 2);
|
||||
cl_assert(exp.file_dels == 5);
|
||||
cl_assert(exp.file_mods == 4);
|
||||
cl_assert(exp.file_ignored == 1);
|
||||
cl_assert(exp.file_untracked == 2);
|
||||
cl_assert(exp.file_untracked == 3);
|
||||
|
||||
cl_assert(exp.hunks == 11);
|
||||
|
||||
@ -144,12 +144,12 @@ void test_diff_workdir__to_tree(void)
|
||||
cl_git_pass(git_diff_foreach(
|
||||
diff, &exp, diff_file_fn, diff_hunk_fn, diff_line_fn));
|
||||
|
||||
cl_assert(exp.files == 15);
|
||||
cl_assert(exp.files == 16);
|
||||
cl_assert(exp.file_adds == 5);
|
||||
cl_assert(exp.file_dels == 4);
|
||||
cl_assert(exp.file_mods == 3);
|
||||
cl_assert(exp.file_ignored == 1);
|
||||
cl_assert(exp.file_untracked == 2);
|
||||
cl_assert(exp.file_untracked == 3);
|
||||
|
||||
cl_assert(exp.hunks == 12);
|
||||
|
||||
@ -182,12 +182,12 @@ void test_diff_workdir__to_index_with_pathspec(void)
|
||||
cl_git_pass(git_diff_workdir_to_index(g_repo, &opts, &diff));
|
||||
cl_git_pass(git_diff_foreach(diff, &exp, diff_file_fn, NULL, NULL));
|
||||
|
||||
cl_assert_equal_i(12, exp.files);
|
||||
cl_assert_equal_i(13, exp.files);
|
||||
cl_assert_equal_i(0, exp.file_adds);
|
||||
cl_assert_equal_i(4, exp.file_dels);
|
||||
cl_assert_equal_i(4, exp.file_mods);
|
||||
cl_assert_equal_i(1, exp.file_ignored);
|
||||
cl_assert_equal_i(3, exp.file_untracked);
|
||||
cl_assert_equal_i(4, exp.file_untracked);
|
||||
|
||||
git_diff_list_free(diff);
|
||||
|
||||
|
1
tests-clar/resources/status/这
Normal file
1
tests-clar/resources/status/这
Normal file
@ -0,0 +1 @@
|
||||
This
|
@ -19,6 +19,8 @@ static const char *entry_paths0[] = {
|
||||
"subdir/deleted_file",
|
||||
"subdir/modified_file",
|
||||
"subdir/new_file",
|
||||
|
||||
"\xe8\xbf\x99",
|
||||
};
|
||||
|
||||
static const unsigned int entry_statuses0[] = {
|
||||
@ -38,9 +40,11 @@ static const unsigned int entry_statuses0[] = {
|
||||
GIT_STATUS_WT_DELETED,
|
||||
GIT_STATUS_WT_MODIFIED,
|
||||
GIT_STATUS_WT_NEW,
|
||||
|
||||
GIT_STATUS_WT_NEW,
|
||||
};
|
||||
|
||||
static const size_t entry_count0 = 15;
|
||||
static const size_t entry_count0 = 16;
|
||||
|
||||
/* entries for a copy of tests/resources/status with all content
|
||||
* deleted from the working directory
|
||||
@ -108,6 +112,7 @@ static const char *entry_paths3[] = {
|
||||
"subdir/current_file",
|
||||
"subdir/deleted_file",
|
||||
"subdir/modified_file",
|
||||
"\xe8\xbf\x99",
|
||||
};
|
||||
|
||||
static const unsigned int entry_statuses3[] = {
|
||||
@ -132,9 +137,10 @@ static const unsigned int entry_statuses3[] = {
|
||||
GIT_STATUS_WT_DELETED,
|
||||
GIT_STATUS_WT_DELETED,
|
||||
GIT_STATUS_WT_DELETED,
|
||||
GIT_STATUS_WT_NEW,
|
||||
};
|
||||
|
||||
static const size_t entry_count3 = 21;
|
||||
static const size_t entry_count3 = 22;
|
||||
|
||||
|
||||
/* entries for a copy of tests/resources/status with some mods
|
||||
@ -163,7 +169,8 @@ static const char *entry_paths4[] = {
|
||||
"subdir/deleted_file",
|
||||
"subdir/modified_file",
|
||||
"zzz_new_dir/new_file",
|
||||
"zzz_new_file"
|
||||
"zzz_new_file",
|
||||
"\xe8\xbf\x99",
|
||||
};
|
||||
|
||||
static const unsigned int entry_statuses4[] = {
|
||||
@ -189,6 +196,7 @@ static const unsigned int entry_statuses4[] = {
|
||||
GIT_STATUS_WT_DELETED,
|
||||
GIT_STATUS_WT_NEW,
|
||||
GIT_STATUS_WT_NEW,
|
||||
GIT_STATUS_WT_NEW,
|
||||
};
|
||||
|
||||
static const size_t entry_count4 = 22;
|
||||
static const size_t entry_count4 = 23;
|
||||
|
Loading…
Reference in New Issue
Block a user