From b6c3c347295a8da797b38926d0f947493ec01c4f Mon Sep 17 00:00:00 2001 From: nulltoken Date: Fri, 28 Jun 2013 17:00:37 +0200 Subject: [PATCH 1/3] tests: Fix indentation --- tests-clar/status/worktree.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index 920671e13bf..eef3b546e02 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -675,30 +675,30 @@ void test_status_worktree__file_status_honors_core_ignorecase_false(void) void test_status_worktree__file_status_honors_case_ignorecase_regarding_untracked_files(void) { - git_repository *repo = cl_git_sandbox_init("status"); - unsigned int status; - git_index *index; + git_repository *repo = cl_git_sandbox_init("status"); + unsigned int status; + git_index *index; - cl_repo_set_bool(repo, "core.ignorecase", false); + cl_repo_set_bool(repo, "core.ignorecase", false); repo = cl_git_sandbox_reopen(); - /* Actually returns GIT_STATUS_IGNORED on Windows */ - cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); + /* Actually returns GIT_STATUS_IGNORED on Windows */ + cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); - cl_git_pass(git_repository_index(&index, repo)); + cl_git_pass(git_repository_index(&index, repo)); - cl_git_pass(git_index_add_bypath(index, "new_file")); - cl_git_pass(git_index_write(index)); - git_index_free(index); + cl_git_pass(git_index_add_bypath(index, "new_file")); + cl_git_pass(git_index_write(index)); + git_index_free(index); - /* Actually returns GIT_STATUS_IGNORED on Windows */ - cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); + /* Actually returns GIT_STATUS_IGNORED on Windows */ + cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); } void test_status_worktree__simple_delete(void) { - git_repository *repo = cl_git_sandbox_init("renames"); + git_repository *repo = cl_git_sandbox_init("renames"); git_status_options opts = GIT_STATUS_OPTIONS_INIT; int count; From 1ec680b84354b9fa9691f7ca65771df11845152c Mon Sep 17 00:00:00 2001 From: nulltoken Date: Fri, 28 Jun 2013 17:04:27 +0200 Subject: [PATCH 2/3] tests: Remove misleading comments --- tests-clar/status/worktree.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index eef3b546e02..c8940ff8338 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -683,7 +683,6 @@ void test_status_worktree__file_status_honors_case_ignorecase_regarding_untracke repo = cl_git_sandbox_reopen(); - /* Actually returns GIT_STATUS_IGNORED on Windows */ cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); cl_git_pass(git_repository_index(&index, repo)); @@ -692,7 +691,6 @@ void test_status_worktree__file_status_honors_case_ignorecase_regarding_untracke cl_git_pass(git_index_write(index)); git_index_free(index); - /* Actually returns GIT_STATUS_IGNORED on Windows */ cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); } From 0c9320d7e27a02d3b521d004bc561ea50ecdc871 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Sat, 29 Jun 2013 08:40:09 +0200 Subject: [PATCH 3/3] status: Add case insensitivity related failing test --- tests-clar/clar_libgit2.h | 4 ++++ tests-clar/repo/init.c | 2 -- tests-clar/status/worktree.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h index 3fcf45a3721..55c0764a3ac 100644 --- a/tests-clar/clar_libgit2.h +++ b/tests-clar/clar_libgit2.h @@ -5,6 +5,10 @@ #include #include "common.h" +#if (defined(GIT_WIN32) || defined(__APPLE__)) +#define CASE_INSENSITIVE_FILESYSTEM 1 +#endif + /** * Replace for `clar_must_pass` that passes the last library error as the * test failure message. diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c index 8cf73795f22..e0a0f67d5f2 100644 --- a/tests-clar/repo/init.c +++ b/tests-clar/repo/init.c @@ -223,8 +223,6 @@ void test_repo_init__detect_filemode(void) #endif } -#define CASE_INSENSITIVE_FILESYSTEM (defined GIT_WIN32 || defined __APPLE__) - void test_repo_init__detect_ignorecase(void) { #if CASE_INSENSITIVE_FILESYSTEM diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index c8940ff8338..c8fb1c173d4 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -694,6 +694,37 @@ void test_status_worktree__file_status_honors_case_ignorecase_regarding_untracke cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); } +void test_status_worktree__file_status_honors_case_ignorecase_on_case_insensitive_platforms(void) +{ +#ifdef CASE_INSENSITIVE_FILESYSTEM + git_repository *repo = cl_git_sandbox_init("status"); + unsigned int status; + git_index *index; + + cl_repo_set_bool(repo, "core.ignorecase", true); + + repo = cl_git_sandbox_reopen(); + + cl_git_pass(git_status_file(&status, repo, "NEW_FILE")); + cl_assert_equal_i(GIT_STATUS_WT_NEW, status); + + cl_git_pass(git_status_file(&status, repo, "new_file")); + cl_assert_equal_i(GIT_STATUS_WT_NEW, status); + + cl_git_pass(git_repository_index(&index, repo)); + + cl_git_pass(git_index_add_bypath(index, "new_file")); + cl_git_pass(git_index_write(index)); + git_index_free(index); + + cl_git_pass(git_status_file(&status, repo, "new_file")); + cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status); + + cl_git_pass(git_status_file(&status, repo, "NEW_FILE")); + cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status); +#endif +} + void test_status_worktree__simple_delete(void) { git_repository *repo = cl_git_sandbox_init("renames");