diff options
author | Vicent Marti <vicent@github.com> | 2014-01-22 10:34:25 -0800 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-01-22 10:34:25 -0800 |
commit | 2b678ce5b4ebbc1d045f2a07651720d8c1e6458c (patch) | |
tree | 53a1d3d414bc798e9a8b40e081be93fb8036a99b /tests | |
parent | ec088fec9dc65621275b9f16d746820af67592de (diff) | |
parent | e8b81c698c52a7197c0842b6503e8b980d773c74 (diff) | |
download | libgit2-2b678ce5b4ebbc1d045f2a07651720d8c1e6458c.tar.gz |
Merge pull request #2070 from ethomson/checkout_filemode
Preserve tree filemode in index during checkout
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkout/tree.c | 23 | ||||
-rw-r--r-- | tests/resources/testrepo/.gitted/objects/1d/d0968be3ff95fcaecb6fa4245662db9fdc4568 | bin | 0 -> 73 bytes | |||
-rw-r--r-- | tests/resources/testrepo/.gitted/objects/af/e4393b2b2a965f06acf2ca9658eaa01e0cd6b6 | bin | 0 -> 171 bytes | |||
-rw-r--r-- | tests/resources/testrepo/.gitted/objects/ce/054d4c5e3c83522aed8bc061987b46b7ede3be | bin | 0 -> 194 bytes |
4 files changed, 23 insertions, 0 deletions
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index f0699fdb7..047c9ed98 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -925,3 +925,26 @@ void test_checkout_tree__fails_when_conflicts_exist_in_index(void) git_object_free(obj); } + +void test_checkout_tree__filemode_preserved_in_index(void) +{ + git_oid executable_oid; + git_commit *commit; + git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT; + git_index *index; + const git_index_entry *entry; + + cl_git_pass(git_repository_index(&index, g_repo)); + + cl_git_pass(git_oid_fromstr(&executable_oid, "afe4393b2b2a965f06acf2ca9658eaa01e0cd6b6")); + cl_git_pass(git_commit_lookup(&commit, g_repo, &executable_oid)); + + opts.checkout_strategy = GIT_CHECKOUT_FORCE; + + cl_git_pass(git_checkout_tree(g_repo, (const git_object *)commit, &opts)); + cl_assert(entry = git_index_get_bypath(index, "executable.txt", 0)); + cl_assert_equal_i(0100755, entry->mode); + + git_commit_free(commit); + git_index_free(index); +} diff --git a/tests/resources/testrepo/.gitted/objects/1d/d0968be3ff95fcaecb6fa4245662db9fdc4568 b/tests/resources/testrepo/.gitted/objects/1d/d0968be3ff95fcaecb6fa4245662db9fdc4568 Binary files differnew file mode 100644 index 000000000..97c6b2cfa --- /dev/null +++ b/tests/resources/testrepo/.gitted/objects/1d/d0968be3ff95fcaecb6fa4245662db9fdc4568 diff --git a/tests/resources/testrepo/.gitted/objects/af/e4393b2b2a965f06acf2ca9658eaa01e0cd6b6 b/tests/resources/testrepo/.gitted/objects/af/e4393b2b2a965f06acf2ca9658eaa01e0cd6b6 Binary files differnew file mode 100644 index 000000000..6948f1b1c --- /dev/null +++ b/tests/resources/testrepo/.gitted/objects/af/e4393b2b2a965f06acf2ca9658eaa01e0cd6b6 diff --git a/tests/resources/testrepo/.gitted/objects/ce/054d4c5e3c83522aed8bc061987b46b7ede3be b/tests/resources/testrepo/.gitted/objects/ce/054d4c5e3c83522aed8bc061987b46b7ede3be Binary files differnew file mode 100644 index 000000000..4910e4c0a --- /dev/null +++ b/tests/resources/testrepo/.gitted/objects/ce/054d4c5e3c83522aed8bc061987b46b7ede3be |