diff options
author | Russell Belfer <rb@github.com> | 2013-06-30 19:43:07 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-07-10 23:15:03 +0400 |
commit | 9564229af42b68d205376853410c55b957546a14 (patch) | |
tree | fd56d14d7fa63fc90dc54e2ac3419d7b193ec042 /tests-clar/diff | |
parent | b8df28a5dae65b617ce85e1937066093600880af (diff) |
Add tests for diff.ignoreSubmdules config
Diffstat (limited to 'tests-clar/diff')
-rw-r--r-- | tests-clar/diff/submodules.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests-clar/diff/submodules.c b/tests-clar/diff/submodules.c index 2e425bb11..fe9cf1d98 100644 --- a/tests-clar/diff/submodules.c +++ b/tests-clar/diff/submodules.c @@ -387,6 +387,7 @@ void test_diff_submodules__diff_ignore_options(void) { git_diff_options opts = GIT_DIFF_OPTIONS_INIT; git_diff_list *diff = NULL; + git_config *cfg; static const char *expected_normal[] = { "<SKIP>", /* .gitmodules */ 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)); check_diff_patches(diff, expected_ignore_dirty); 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); } |