mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 20:14:44 +00:00
Add tests for diff.ignoreSubmdules config
This commit is contained in:
parent
b8df28a5da
commit
9564229af4
@ -387,6 +387,7 @@ void test_diff_submodules__diff_ignore_options(void)
|
|||||||
{
|
{
|
||||||
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
||||||
git_diff_list *diff = NULL;
|
git_diff_list *diff = NULL;
|
||||||
|
git_config *cfg;
|
||||||
static const char *expected_normal[] = {
|
static const char *expected_normal[] = {
|
||||||
"<SKIP>", /* .gitmodules */
|
"<SKIP>", /* .gitmodules */
|
||||||
NULL, /* not-submodule */
|
NULL, /* not-submodule */
|
||||||
@ -440,4 +441,32 @@ void test_diff_submodules__diff_ignore_options(void)
|
|||||||
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
|
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
|
||||||
check_diff_patches(diff, expected_ignore_dirty);
|
check_diff_patches(diff, expected_ignore_dirty);
|
||||||
git_diff_list_free(diff);
|
git_diff_list_free(diff);
|
||||||
|
|
||||||
|
opts.ignore_submodules = 0;
|
||||||
|
cl_git_pass(git_repository_config(&cfg, g_repo));
|
||||||
|
cl_git_pass(git_config_set_bool(cfg, "diff.ignoreSubmodules", false));
|
||||||
|
|
||||||
|
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
|
||||||
|
check_diff_patches(diff, expected_normal);
|
||||||
|
git_diff_list_free(diff);
|
||||||
|
|
||||||
|
cl_git_pass(git_config_set_bool(cfg, "diff.ignoreSubmodules", true));
|
||||||
|
|
||||||
|
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
|
||||||
|
check_diff_patches(diff, expected_ignore_all);
|
||||||
|
git_diff_list_free(diff);
|
||||||
|
|
||||||
|
cl_git_pass(git_config_set_string(cfg, "diff.ignoreSubmodules", "none"));
|
||||||
|
|
||||||
|
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
|
||||||
|
check_diff_patches(diff, expected_normal);
|
||||||
|
git_diff_list_free(diff);
|
||||||
|
|
||||||
|
cl_git_pass(git_config_set_string(cfg, "diff.ignoreSubmodules", "dirty"));
|
||||||
|
|
||||||
|
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
|
||||||
|
check_diff_patches(diff, expected_ignore_dirty);
|
||||||
|
git_diff_list_free(diff);
|
||||||
|
|
||||||
|
git_config_free(cfg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user