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
a2f9f94b
Commit
a2f9f94b
authored
Oct 20, 2018
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-4203'
parents
2ad07ad5
32b81661
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
+35
-1
src/merge.c
+6
-1
tests/merge/workdir/simple.c
+29
-0
No files found.
src/merge.c
View file @
a2f9f94b
...
...
@@ -3243,7 +3243,7 @@ int git_merge(
git_reference
*
our_ref
=
NULL
;
git_checkout_options
checkout_opts
;
git_annotated_commit
*
our_head
=
NULL
,
*
base
=
NULL
;
git_index
*
index
=
NULL
;
git_index
*
repo_index
=
NULL
,
*
index
=
NULL
;
git_indexwriter
indexwriter
=
GIT_INDEXWRITER_INIT
;
unsigned
int
checkout_strategy
;
int
error
=
0
;
...
...
@@ -3266,6 +3266,10 @@ int git_merge(
&
checkout_strategy
))
<
0
)
goto
done
;
if
((
error
=
git_repository_index
(
&
repo_index
,
repo
)
<
0
)
||
(
error
=
git_index_read
(
repo_index
,
0
)
<
0
))
goto
done
;
/* Write the merge setup files to the repository. */
if
((
error
=
git_annotated_commit_from_head
(
&
our_head
,
repo
))
<
0
||
(
error
=
git_merge__setup
(
repo
,
our_head
,
their_heads
,
...
...
@@ -3299,6 +3303,7 @@ done:
git_annotated_commit_free
(
our_head
);
git_annotated_commit_free
(
base
);
git_reference_free
(
our_ref
);
git_index_free
(
repo_index
);
return
error
;
}
...
...
tests/merge/workdir/simple.c
View file @
a2f9f94b
...
...
@@ -168,6 +168,35 @@ void test_merge_workdir_simple__automerge(void)
git_index_free
(
index
);
}
void
test_merge_workdir_simple__index_reload
(
void
)
{
git_repository
*
tmp_repo
;
git_annotated_commit
*
their_heads
[
1
];
git_oid
their_oid
;
git_index_entry
entry
=
{{
0
}};
git_index
*
tmp_index
;
cl_git_pass
(
git_repository_open
(
&
tmp_repo
,
git_repository_workdir
(
repo
)));
cl_git_pass
(
git_repository_index
(
&
tmp_index
,
tmp_repo
));
cl_git_pass
(
git_index_read
(
repo_index
,
0
));
entry
.
mode
=
GIT_FILEMODE_BLOB
;
cl_git_pass
(
git_oid_fromstr
(
&
entry
.
id
,
"11deab00b2d3a6f5a3073988ac050c2d7b6655e2"
));
entry
.
path
=
"automergeable.txt"
;
cl_git_pass
(
git_index_add
(
repo_index
,
&
entry
));
cl_git_pass
(
git_index_add_bypath
(
tmp_index
,
"automergeable.txt"
));
cl_git_pass
(
git_index_write
(
tmp_index
));
cl_git_pass
(
git_oid_fromstr
(
&
their_oid
,
THEIRS_SIMPLE_OID
));
cl_git_pass
(
git_annotated_commit_lookup
(
&
their_heads
[
0
],
repo
,
&
their_oid
));
cl_git_pass
(
git_merge
(
repo
,
(
const
git_annotated_commit
**
)
their_heads
,
1
,
NULL
,
NULL
));
git_index_free
(
tmp_index
);
git_repository_free
(
tmp_repo
);
git_annotated_commit_free
(
their_heads
[
0
]);
}
void
test_merge_workdir_simple__automerge_crlf
(
void
)
{
#ifdef GIT_WIN32
...
...
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