Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
2a3e0635
Commit
2a3e0635
authored
Dec 04, 2017
by
David Turner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not attempt to check out submodule as blob when merging a submodule modify/deltete conflict
parent
429bb357
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
2 deletions
+45
-2
src/checkout.c
+5
-2
tests/merge/workdir/submodules.c
+36
-0
tests/resources/merge-resolve/.gitted/objects/50/c5dc8cdfe40c688eb0a0e23be54dd57cae2e78
+3
-0
tests/resources/merge-resolve/.gitted/objects/7a/a825857f87aea74ddf13d954568aa30dfcdeb4
+0
-0
tests/resources/merge-resolve/.gitted/refs/heads/delete-submodule
+1
-0
No files found.
src/checkout.c
View file @
2a3e0635
...
...
@@ -2022,8 +2022,11 @@ static int checkout_write_entry(
(
error
=
checkout_safe_for_update_only
(
data
,
fullpath
->
ptr
,
side
->
mode
))
<=
0
)
return
error
;
return
checkout_write_content
(
data
,
&
side
->
id
,
fullpath
->
ptr
,
hint_path
,
side
->
mode
,
&
st
);
if
(
!
S_ISGITLINK
(
side
->
mode
))
return
checkout_write_content
(
data
,
&
side
->
id
,
fullpath
->
ptr
,
hint_path
,
side
->
mode
,
&
st
);
return
0
;
}
static
int
checkout_write_entries
(
...
...
tests/merge/workdir/submodules.c
View file @
2a3e0635
...
...
@@ -12,6 +12,7 @@ static git_repository *repo;
#define SUBMODULE_MAIN_BRANCH "submodules"
#define SUBMODULE_OTHER_BRANCH "submodules-branch"
#define SUBMODULE_OTHER2_BRANCH "submodules-branch2"
#define SUBMODULE_DELETE_BRANCH "delete-submodule"
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
...
...
@@ -93,3 +94,38 @@ void test_merge_workdir_submodules__take_changed(void)
git_reference_free
(
their_ref
);
git_reference_free
(
our_ref
);
}
void
test_merge_workdir_submodules__update_delete_conflict
(
void
)
{
git_reference
*
our_ref
,
*
their_ref
;
git_commit
*
our_commit
;
git_annotated_commit
*
their_head
;
git_index
*
index
;
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
,
0
,
".gitmodules"
},
{
0100644
,
"5887a5e516c53bd58efb0f02ec6aa031b6fe9ad7"
,
0
,
"file1.txt"
},
{
0100644
,
"4218670ab81cc219a9f94befb5c5dad90ec52648"
,
0
,
"file2.txt"
},
{
0160000
,
"d3d806a4bef96889117fd7ebac0e3cb5ec152932"
,
1
,
"submodule"
},
{
0160000
,
"297aa6cd028b3336c7802c7a6f49143da4e1602d"
,
3
,
"submodule"
},
};
cl_git_pass
(
git_reference_lookup
(
&
our_ref
,
repo
,
"refs/heads/"
SUBMODULE_DELETE_BRANCH
));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
git_reference_target
(
our_ref
)));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
their_ref
,
repo
,
"refs/heads/"
SUBMODULE_MAIN_BRANCH
));
cl_git_pass
(
git_annotated_commit_from_ref
(
&
their_head
,
repo
,
their_ref
));
cl_git_pass
(
git_merge
(
repo
,
(
const
git_annotated_commit
**
)
&
their_head
,
1
,
NULL
,
NULL
));
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
cl_assert
(
merge_test_index
(
index
,
merge_index_entries
,
5
));
git_index_free
(
index
);
git_annotated_commit_free
(
their_head
);
git_commit_free
(
our_commit
);
git_reference_free
(
their_ref
);
git_reference_free
(
our_ref
);
}
tests/resources/merge-resolve/.gitted/objects/50/c5dc8cdfe40c688eb0a0e23be54dd57cae2e78
0 → 100644
View file @
2a3e0635
File added
tests/resources/merge-resolve/.gitted/objects/7a/a825857f87aea74ddf13d954568aa30dfcdeb4
0 → 100644
View file @
2a3e0635
File added
tests/resources/merge-resolve/.gitted/refs/heads/delete-submodule
0 → 100644
View file @
2a3e0635
50c5dc8cdfe40c688eb0a0e23be54dd57cae2e78
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment