| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -816,8 +816,11 @@ static int merge_conflict_resolve_one_renamed( | |||
| 816 | 816 | conflict->type == GIT_MERGE_DIFF_RENAMED_ADDED) | |
| 817 | 817 | return 0; | |
| 818 | 818 | ||
| 819 | - ours_changed = (git_oid__cmp(&conflict->ancestor_entry.id, &conflict->our_entry.id) != 0); | ||
| 820 | - theirs_changed = (git_oid__cmp(&conflict->ancestor_entry.id, &conflict->their_entry.id) != 0); | ||
| 819 | + ours_changed = (git_oid__cmp(&conflict->ancestor_entry.id, &conflict->our_entry.id) != 0) || | ||
| 820 | + (conflict->ancestor_entry.mode != conflict->our_entry.mode); | ||
| 821 | + | ||
| 822 | + theirs_changed = (git_oid__cmp(&conflict->ancestor_entry.id, &conflict->their_entry.id) != 0) || | ||
| 823 | + (conflict->ancestor_entry.mode != conflict->their_entry.mode); | ||
| 821 | 824 | ||
| 822 | 825 | /* if both are modified (and not to a common target) require a merge */ | |
| 823 | 826 | if (ours_changed && theirs_changed && | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + ref: refs/heads/master | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + [core] | ||
| 2 | + repositoryformatversion = 0 | ||
| 3 | + filemode = true | ||
| 4 | + bare = true | ||
| 5 | + logallrefupdates = true | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + P pack-4363774fb90141e8aa7a326ace0566366114e869.pack | ||
| 2 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + # pack-refs with: peeled fully-peeled sorted | ||
| 2 | + ecef6a85173b6f446873a13f7b5a7b54a85cd912 refs/heads/master | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + ecef6a85173b6f446873a13f7b5a7b54a85cd912 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,49 @@ | |||
| 1 | + #include "clar.h" | ||
| 2 | + #include "clar_libgit2.h" | ||
| 3 | + | ||
| 4 | + #include "git2/revert.h" | ||
| 5 | + #include "../merge/merge_helpers.h" | ||
| 6 | + | ||
| 7 | + #define TEST_REPO_PATH "revert-rename.git" | ||
| 8 | + | ||
| 9 | + static git_repository *repo; | ||
| 10 | + | ||
| 11 | + /* Fixture setup and teardown */ | ||
| 12 | + void test_revert_rename__initialize(void) | ||
| 13 | + { | ||
| 14 | + repo = cl_git_sandbox_init(TEST_REPO_PATH); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + void test_revert_rename__cleanup(void) | ||
| 18 | + { | ||
| 19 | + cl_git_sandbox_cleanup(); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + /* Attempt a revert when there is a file rename AND change of file mode, | ||
| 23 | + * but the file contents remain the same. Check that the file mode doesn't | ||
| 24 | + * change following the revert. | ||
| 25 | + */ | ||
| 26 | + void test_revert_rename__automerge(void) | ||
| 27 | + { | ||
| 28 | + git_commit *head_commit, *revert_commit; | ||
| 29 | + git_oid revert_oid; | ||
| 30 | + git_index *index; | ||
| 31 | + git_reference *head_ref; | ||
| 32 | + | ||
| 33 | + struct merge_index_entry merge_index_entries[] = { | ||
| 34 | + { 0100644, "f0f64c618e1646d2948a456ed7c4bcfad5536d68", 0, "goodmode" }}; | ||
| 35 | + | ||
| 36 | + cl_git_pass(git_repository_head(&head_ref, repo)); | ||
| 37 | + cl_git_pass(git_reference_peel((git_object **)&head_commit, head_ref, GIT_OBJECT_COMMIT)); | ||
| 38 | + | ||
| 39 | + cl_git_pass(git_oid_fromstr(&revert_oid, "7b4d7c3789b3581973c04087cb774c3c3576de2f")); | ||
| 40 | + cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_oid)); | ||
| 41 | + | ||
| 42 | + cl_git_pass(git_revert_commit(&index, repo, revert_commit, head_commit, 0, NULL)); | ||
| 43 | + cl_assert(merge_test_index(index, merge_index_entries, 1)); | ||
| 44 | + | ||
| 45 | + git_commit_free(revert_commit); | ||
| 46 | + git_commit_free(head_commit); | ||
| 47 | + git_index_free(index); | ||
| 48 | + git_reference_free(head_ref); | ||
| 49 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments