diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-02-14 19:44:05 +0300 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-02-27 21:50:44 +0300 |
commit | 96b82b11c64ffcf00e0d10b1bad1b6d1fbfc896c (patch) | |
tree | bcca5b2ad67134d451cc3e1d9fe2980cb58b68c6 /tests | |
parent | 14fec0aea3b57bdf29ab7a195061127f8a3edc30 (diff) |
checkout: remove `GIT_CHECKOUT_SAFE_CREATE` as a strategy
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkout/.icase.c.swp | bin | 0 -> 12288 bytes | |||
-rw-r--r-- | tests/checkout/crlf.c | 30 | ||||
-rw-r--r-- | tests/checkout/index.c | 49 | ||||
-rw-r--r-- | tests/checkout/tree.c | 16 | ||||
-rw-r--r-- | tests/checkout/typechange.c | 3 |
5 files changed, 58 insertions, 40 deletions
diff --git a/tests/checkout/.icase.c.swp b/tests/checkout/.icase.c.swp Binary files differnew file mode 100644 index 000000000..facd136ff --- /dev/null +++ b/tests/checkout/.icase.c.swp diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c index b6d4e949a..ecbcc8a90 100644 --- a/tests/checkout/crlf.c +++ b/tests/checkout/crlf.c @@ -21,7 +21,7 @@ void test_checkout_crlf__cleanup(void) void test_checkout_crlf__detect_crlf_autocrlf_false(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", false); @@ -36,7 +36,7 @@ void test_checkout_crlf__autocrlf_false_index_size_is_unfiltered_size(void) git_index *index; const git_index_entry *entry; git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", false); @@ -56,7 +56,7 @@ void test_checkout_crlf__autocrlf_false_index_size_is_unfiltered_size(void) void test_checkout_crlf__detect_crlf_autocrlf_true(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", true); @@ -73,7 +73,7 @@ void test_checkout_crlf__detect_crlf_autocrlf_true(void) void test_checkout_crlf__more_lf_autocrlf_true(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", true); @@ -85,7 +85,7 @@ void test_checkout_crlf__more_lf_autocrlf_true(void) void test_checkout_crlf__more_crlf_autocrlf_true(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", true); @@ -97,7 +97,7 @@ void test_checkout_crlf__more_crlf_autocrlf_true(void) void test_checkout_crlf__all_crlf_autocrlf_true(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", true); @@ -109,7 +109,7 @@ void test_checkout_crlf__all_crlf_autocrlf_true(void) void test_checkout_crlf__detect_crlf_autocrlf_true_utf8(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", true); @@ -136,7 +136,7 @@ void test_checkout_crlf__autocrlf_true_index_size_is_filtered_size(void) git_index *index; const git_index_entry *entry; git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", true); @@ -162,7 +162,7 @@ void test_checkout_crlf__with_ident(void) git_index *index; git_blob *blob; git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_mkfile("crlf/.gitattributes", "*.txt text\n*.bin binary\n" @@ -252,7 +252,7 @@ void test_checkout_crlf__with_ident(void) void test_checkout_crlf__autocrlf_false_no_attrs(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", false); @@ -265,7 +265,7 @@ void test_checkout_crlf__autocrlf_false_no_attrs(void) void test_checkout_crlf__autocrlf_true_no_attrs(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_bool(g_repo, "core.autocrlf", true); @@ -283,7 +283,7 @@ void test_checkout_crlf__autocrlf_true_no_attrs(void) void test_checkout_crlf__autocrlf_input_no_attrs(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_repo_set_string(g_repo, "core.autocrlf", "input"); @@ -296,7 +296,7 @@ void test_checkout_crlf__autocrlf_input_no_attrs(void) void test_checkout_crlf__autocrlf_false_text_auto_attr(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_mkfile("./crlf/.gitattributes", "* text=auto\n"); @@ -316,7 +316,7 @@ void test_checkout_crlf__autocrlf_false_text_auto_attr(void) void test_checkout_crlf__autocrlf_true_text_auto_attr(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_mkfile("./crlf/.gitattributes", "* text=auto\n"); @@ -336,7 +336,7 @@ void test_checkout_crlf__autocrlf_true_text_auto_attr(void) void test_checkout_crlf__autocrlf_input_text_auto_attr(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_mkfile("./crlf/.gitattributes", "* text=auto\n"); diff --git a/tests/checkout/index.c b/tests/checkout/index.c index 112324a04..63ed4b177 100644 --- a/tests/checkout/index.c +++ b/tests/checkout/index.c @@ -49,7 +49,7 @@ void test_checkout_index__can_create_missing_files(void) cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt")); cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt")); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -69,7 +69,9 @@ void test_checkout_index__can_remove_untracked_files(void) cl_assert_equal_i(true, git_path_isdir("./testrepo/dir/subdir/subsubdir")); opts.checkout_strategy = - GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_REMOVE_UNTRACKED; + GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING | + GIT_CHECKOUT_REMOVE_UNTRACKED; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -88,7 +90,7 @@ void test_checkout_index__honor_the_specified_pathspecs(void) cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt")); cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt")); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -107,7 +109,7 @@ void test_checkout_index__honor_the_gitattributes_directives(void) cl_git_mkfile("./testrepo/.gitattributes", attributes); cl_repo_set_bool(g_repo, "core.autocrlf", false); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -125,7 +127,7 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void) cl_git_pass(p_unlink("./testrepo/.gitattributes")); cl_repo_set_bool(g_repo, "core.autocrlf", true); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -139,7 +141,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_true(void) cl_repo_set_bool(g_repo, "core.symlinks", true); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -165,7 +167,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_false(void) cl_repo_set_bool(g_repo, "core.symlinks", false); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -207,7 +209,7 @@ void test_checkout_index__options_disable_filters(void) cl_git_mkfile("./testrepo/.gitattributes", "*.txt text eol=crlf\n"); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; opts.disable_filters = false; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -238,7 +240,7 @@ void test_checkout_index__options_dir_modes(void) reset_index_to_treeish((git_object *)commit); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; opts.dir_mode = 0701; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -264,7 +266,7 @@ void test_checkout_index__options_override_file_modes(void) if (!cl_is_chmod_supported()) return; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; opts.file_mode = 0700; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -329,8 +331,9 @@ void test_checkout_index__can_notify_of_skipped_files(void) data.file = "new.txt"; data.sha = "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"; - opts.checkout_strategy = - GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_ALLOW_CONFLICTS; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING | + GIT_CHECKOUT_ALLOW_CONFLICTS; opts.notify_flags = GIT_CHECKOUT_NOTIFY_CONFLICT; opts.notify_cb = test_checkout_notify_cb; opts.notify_payload = &data; @@ -368,7 +371,9 @@ void test_checkout_index__wont_notify_of_expected_line_ending_changes(void) cl_git_mkfile("./testrepo/new.txt", "my new file\r\n"); opts.checkout_strategy = - GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_ALLOW_CONFLICTS; + GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING | + GIT_CHECKOUT_ALLOW_CONFLICTS; opts.notify_flags = GIT_CHECKOUT_NOTIFY_CONFLICT; opts.notify_cb = dont_notify_cb; opts.notify_payload = NULL; @@ -388,7 +393,7 @@ void test_checkout_index__calls_progress_callback(void) git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; int calls = 0; - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; opts.progress_cb = checkout_progress_counter; opts.progress_payload = &calls; @@ -423,7 +428,9 @@ void test_checkout_index__can_overcome_name_clashes(void) cl_assert(git_path_isfile("./testrepo/path0/file0")); opts.checkout_strategy = - GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_ALLOW_CONFLICTS; + GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING | + GIT_CHECKOUT_ALLOW_CONFLICTS; cl_git_pass(git_checkout_index(g_repo, index, &opts)); cl_assert(git_path_isfile("./testrepo/path1")); @@ -473,7 +480,9 @@ void test_checkout_index__can_update_prefixed_files(void) cl_git_pass(p_mkdir("./testrepo/branch_file.txt.after", 0777)); opts.checkout_strategy = - GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_REMOVE_UNTRACKED; + GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING | + GIT_CHECKOUT_REMOVE_UNTRACKED; cl_git_pass(git_checkout_index(g_repo, NULL, &opts)); @@ -523,7 +532,8 @@ void test_checkout_index__target_directory(void) checkout_counts cts; memset(&cts, 0, sizeof(cts)); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING; opts.target_directory = "alternative"; cl_assert(!git_path_isdir("alternative")); @@ -568,7 +578,8 @@ void test_checkout_index__target_directory_from_bare(void) cl_git_pass(git_index_write(index)); git_index_free(index); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING; opts.notify_flags = GIT_CHECKOUT_NOTIFY_ALL; opts.notify_cb = checkout_count_callback; @@ -606,7 +617,7 @@ void test_checkout_index__can_get_repo_from_index(void) cl_assert_equal_i(false, git_path_isfile("./testrepo/branch_file.txt")); cl_assert_equal_i(false, git_path_isfile("./testrepo/new.txt")); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_repository_index(&index, g_repo)); diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index 1b4a33273..80038871c 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -15,7 +15,8 @@ void test_checkout_tree__initialize(void) g_repo = cl_git_sandbox_init("testrepo"); GIT_INIT_STRUCTURE(&g_opts, GIT_CHECKOUT_OPTIONS_VERSION); - g_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + g_opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING; } void test_checkout_tree__cleanup(void) @@ -408,7 +409,8 @@ void test_checkout_tree__can_checkout_with_pattern(void) /* now to a narrow patterned checkout */ - g_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + g_opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING; g_opts.paths.strings = entries; g_opts.paths.count = 1; @@ -445,7 +447,9 @@ void test_checkout_tree__can_disable_pattern_match(void) /* now to a narrow patterned checkout, but disable pattern */ g_opts.checkout_strategy = - GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH; + GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING | + GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH; g_opts.paths.strings = entries; g_opts.paths.count = 1; @@ -457,7 +461,8 @@ void test_checkout_tree__can_disable_pattern_match(void) /* let's try that again, but allow the pattern match */ - g_opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + g_opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING; cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts)); @@ -824,7 +829,8 @@ void test_checkout_tree__target_directory_from_bare(void) g_repo = cl_git_sandbox_init("testrepo.git"); cl_assert(git_repository_is_bare(g_repo)); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING; opts.notify_flags = GIT_CHECKOUT_NOTIFY_ALL; opts.notify_cb = checkout_count_callback; diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c index 7aa14b36d..4a0b38ae0 100644 --- a/tests/checkout/typechange.c +++ b/tests/checkout/typechange.c @@ -212,7 +212,8 @@ void test_checkout_typechange__checkout_with_conflicts(void) p_mkdir("typechanges/d", 0777); /* intentionally empty dir */ force_create_file("typechanges/untracked"); - opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE; + opts.checkout_strategy = GIT_CHECKOUT_SAFE | + GIT_CHECKOUT_RECREATE_MISSING; memset(&cts, 0, sizeof(cts)); cl_git_fail(git_checkout_tree(g_repo, obj, &opts)); |