Commit 73615900 by Edward Thomson Committed by Patrick Steinhardt

checkout test: ensure workdir perms are updated

When the working directory has changed permissions on a file - but only
the permissions, such that the contents of the file are identical -
ensure that `git_checkout` updates the permissions to match the checkout
target.
parent 3983fc1d
...@@ -136,3 +136,23 @@ void test_checkout_head__do_remove_tracked_subdir(void) ...@@ -136,3 +136,23 @@ void test_checkout_head__do_remove_tracked_subdir(void)
cl_assert(!git_path_isfile("testrepo/subdir/tracked-file")); cl_assert(!git_path_isfile("testrepo/subdir/tracked-file"));
cl_assert(git_path_isfile("testrepo/subdir/untracked-file")); cl_assert(git_path_isfile("testrepo/subdir/untracked-file"));
} }
void test_checkout_head__typechange_workdir(void)
{
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
git_object *target;
struct stat st;
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_revparse_single(&target, g_repo, "HEAD"));
cl_git_pass(git_reset(g_repo, target, GIT_RESET_HARD, NULL));
cl_must_pass(p_chmod("testrepo/new.txt", 0755));
cl_git_pass(git_checkout_head(g_repo, &opts));
cl_git_pass(p_stat("testrepo/new.txt", &st));
cl_assert(!GIT_PERMS_IS_EXEC(st.st_mode));
git_object_free(target);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment