diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-08-04 01:48:33 +0300 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-08-04 02:33:15 +0300 |
commit | bdec336301c348404b0590025025420febae5b98 (patch) | |
tree | 83a8cc76ec12f578fa2d633e927aa525c085b0f7 /tests/index | |
parent | 69adb781e17f77b19d66613ad7e52c38d6ac64e1 (diff) |
win32: ensure hidden files can be staged
Diffstat (limited to 'tests/index')
-rw-r--r-- | tests/index/addall.c | 35 | ||||
-rw-r--r-- | tests/index/bypath.c | 26 |
2 files changed, 61 insertions, 0 deletions
diff --git a/tests/index/addall.c b/tests/index/addall.c index 9ddb27f95..7b7a178d1 100644 --- a/tests/index/addall.c +++ b/tests/index/addall.c @@ -307,6 +307,41 @@ void test_index_addall__files_in_folders(void) git_index_free(index); } +void test_index_addall__hidden_files(void) +{ + git_index *index; + + GIT_UNUSED(index); + +#ifdef GIT_WIN32 + addall_create_test_repo(true); + + cl_git_pass(git_repository_index(&index, g_repo)); + + cl_git_pass(git_index_add_all(index, NULL, 0, NULL, NULL)); + check_stat_data(index, TEST_DIR "/file.bar", true); + check_status(g_repo, 2, 0, 0, 0, 0, 0, 1, 0); + + cl_git_mkfile(TEST_DIR "/file.zzz", "yet another one"); + cl_git_mkfile(TEST_DIR "/more.zzz", "yet another one"); + cl_git_mkfile(TEST_DIR "/other.zzz", "yet another one"); + + check_status(g_repo, 2, 0, 0, 3, 0, 0, 1, 0); + + cl_git_pass(git_win32__set_hidden(TEST_DIR "/file.zzz", true)); + cl_git_pass(git_win32__set_hidden(TEST_DIR "/more.zzz", true)); + cl_git_pass(git_win32__set_hidden(TEST_DIR "/other.zzz", true)); + + check_status(g_repo, 2, 0, 0, 3, 0, 0, 1, 0); + + cl_git_pass(git_index_add_all(index, NULL, 0, NULL, NULL)); + check_stat_data(index, TEST_DIR "/file.bar", true); + check_status(g_repo, 5, 0, 0, 0, 0, 0, 1, 0); + + git_index_free(index); +#endif +} + static int addall_match_prefix( const char *path, const char *matched_pathspec, void *payload) { diff --git a/tests/index/bypath.c b/tests/index/bypath.c index 9706a8833..b607e1732 100644 --- a/tests/index/bypath.c +++ b/tests/index/bypath.c @@ -46,3 +46,29 @@ void test_index_bypath__add_submodule_unregistered(void) cl_assert_equal_s(sm_head, git_oid_tostr_s(&entry->id)); cl_assert_equal_s(sm_name, entry->path); } + +void test_index_bypath__add_hidden(void) +{ + const git_index_entry *entry; + bool hidden; + + GIT_UNUSED(entry); + GIT_UNUSED(hidden); + +#ifdef GIT_WIN32 + cl_git_mkfile("submod2/hidden_file", "you can't see me"); + + cl_git_pass(git_win32__hidden(&hidden, "submod2/hidden_file")); + cl_assert(!hidden); + + cl_git_pass(git_win32__set_hidden("submod2/hidden_file", true)); + + cl_git_pass(git_win32__hidden(&hidden, "submod2/hidden_file")); + cl_assert(hidden); + + cl_git_pass(git_index_add_bypath(g_idx, "hidden_file")); + + cl_assert(entry = git_index_get_bypath(g_idx, "hidden_file", 0)); + cl_assert_equal_i(GIT_FILEMODE_BLOB, entry->mode); +#endif +} |