summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@vercel.com>2023-03-02 00:15:08 +0000
committerEdward Thomson <ethomson@vercel.com>2023-03-02 23:09:36 +0000
commit6fb5ab372366a92ae36aac36e1427158c22f3278 (patch)
treeb1d7bfe74f215ef92d0cee664c685e9b7925de66
parentaf12fc11c520b58fe548a5ff736812462c269685 (diff)
downloadlibgit2-6fb5ab372366a92ae36aac36e1427158c22f3278.tar.gz
index: test `git_index_add_all` with ignored folder
Ensure that when all files beneath a directory are ignored that we actually ignore the files.
-rw-r--r--tests/libgit2/index/addall.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/libgit2/index/addall.c b/tests/libgit2/index/addall.c
index 6f95f6386..0d3407d48 100644
--- a/tests/libgit2/index/addall.c
+++ b/tests/libgit2/index/addall.c
@@ -441,6 +441,29 @@ void test_index_addall__callback_filtering(void)
git_index_free(index);
}
+void test_index_addall__handles_ignored_files_in_directory(void)
+{
+ git_index *index;
+
+ g_repo = cl_git_sandbox_init_new(TEST_DIR);
+
+ cl_git_mkfile(TEST_DIR "/file.foo", "a file");
+ cl_git_mkfile(TEST_DIR "/file.bar", "another file");
+ cl_must_pass(p_mkdir(TEST_DIR "/folder", 0777));
+ cl_git_mkfile(TEST_DIR "/folder/asdf", "yet another file");
+
+ cl_git_mkfile(TEST_DIR "/.gitignore", "folder/\n");
+
+ check_status(g_repo, 0, 0, 0, 3, 0, 0, 1, 0);
+
+ cl_git_pass(git_repository_index(&index, g_repo));
+ cl_git_pass(git_index_add_all(index, NULL, 0, NULL, NULL));
+
+ check_status(g_repo, 3, 0, 0, 0, 0, 0, 1, 0);
+
+ git_index_free(index);
+}
+
void test_index_addall__adds_conflicts(void)
{
git_index *index;