diff options
-rw-r--r-- | tests/checkout/head.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/checkout/head.c b/tests/checkout/head.c index 866eb9a0b..99061466f 100644 --- a/tests/checkout/head.c +++ b/tests/checkout/head.c @@ -182,6 +182,33 @@ void test_checkout_head__typechange_index_and_workdir(void) git_index_free(index); } +void test_checkout_head__workdir_filemode_is_simplified(void) +{ + git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; + git_object *target, *branch; + + opts.checkout_strategy = GIT_CHECKOUT_FORCE; + + cl_git_pass(git_revparse_single(&target, g_repo, "a38d028f71eaa590febb7d716b1ca32350cf70da")); + cl_git_pass(git_reset(g_repo, target, GIT_RESET_HARD, NULL)); + + cl_must_pass(p_chmod("testrepo/branch_file.txt", 0666)); + + /* + * Checkout should not fail with a conflict; though the file mode + * on disk is literally different to the base (0666 vs 0644), Git + * ignores the actual mode and simply treats both as non-executable. + */ + cl_git_pass(git_revparse_single(&branch, g_repo, "099fabac3a9ea935598528c27f866e34089c2eff")); + + opts.checkout_strategy &= ~GIT_CHECKOUT_FORCE; + opts.checkout_strategy |= GIT_CHECKOUT_SAFE; + cl_git_pass(git_checkout_tree(g_repo, branch, NULL)); + + git_object_free(branch); + git_object_free(target); +} + void test_checkout_head__obeys_filemode_true(void) { git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; |