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
9d8510b3
Unverified
Commit
9d8510b3
authored
Jan 31, 2018
by
Edward Thomson
Committed by
GitHub
Jan 31, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4488 from libgit2/ethomson/conflict_marker_size
Use longer conflict markers in recursive merge base
parents
cdab165d
db39807c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
8 deletions
+23
-8
CHANGELOG.md
+6
-0
include/git2/merge.h
+6
-0
src/merge.c
+1
-0
src/merge_file.c
+2
-0
tests/merge/conflict_data.h
+4
-4
tests/merge/trees/recursive.c
+2
-2
tests/merge/workdir/recursive.c
+2
-2
No files found.
CHANGELOG.md
View file @
9d8510b3
...
...
@@ -26,6 +26,12 @@ v0.26 + 1
### Breaking API changes
*
The
`git_merge_file_options`
structure now contains a new setting,
`marker_size`
. This allows users to set the size of markers that
delineate the sides of merged files in the output conflict file.
By default this is 7 (
`GIT_MERGE_CONFLICT_MARKER_SIZE`
), which
produces output markers like
`<<<<<<<`
and
`>>>>>>>`
.
v0.26
-----
...
...
include/git2/merge.h
View file @
9d8510b3
...
...
@@ -162,6 +162,8 @@ typedef enum {
GIT_MERGE_FILE_DIFF_MINIMAL
=
(
1
<<
7
),
}
git_merge_file_flag_t
;
#define GIT_MERGE_CONFLICT_MARKER_SIZE 7
/**
* Options for merging a file
*/
...
...
@@ -191,6 +193,10 @@ typedef struct {
/** see `git_merge_file_flag_t` above */
git_merge_file_flag_t
flags
;
/** The size of conflict markers (eg, "<<<<<<<"). Default is
* GIT_MERGE_CONFLICT_MARKER_SIZE. */
unsigned
short
marker_size
;
}
git_merge_file_options
;
#define GIT_MERGE_FILE_OPTIONS_VERSION 1
...
...
src/merge.c
View file @
9d8510b3
...
...
@@ -2075,6 +2075,7 @@ int git_merge__iterators(
file_opts
.
our_label
=
"Temporary merge branch 1"
;
file_opts
.
their_label
=
"Temporary merge branch 2"
;
file_opts
.
flags
|=
GIT_MERGE_FILE_FAVOR__CONFLICTED
;
file_opts
.
marker_size
=
GIT_MERGE_CONFLICT_MARKER_SIZE
+
2
;
}
diff_list
=
git_merge_diff_list__alloc
(
repo
);
...
...
src/merge_file.c
View file @
9d8510b3
...
...
@@ -126,6 +126,8 @@ static int merge_file__xdiff(
if
(
options
.
flags
&
GIT_MERGE_FILE_DIFF_MINIMAL
)
xmparam
.
xpp
.
flags
|=
XDF_NEED_MINIMAL
;
xmparam
.
marker_size
=
options
.
marker_size
;
if
((
xdl_result
=
xdl_merge
(
&
ancestor_mmfile
,
&
our_mmfile
,
&
their_mmfile
,
&
xmparam
,
&
mmbuffer
))
<
0
)
{
giterr_set
(
GITERR_MERGE
,
"failed to merge files"
);
...
...
tests/merge/conflict_data.h
View file @
9d8510b3
...
...
@@ -76,13 +76,13 @@
"<<<<<<< HEAD\n" \
"put into a pot three quarts of water, three onions cut small, one\n" \
"||||||| merged common ancestors\n" \
"<<<<<<< Temporary merge branch 1\n" \
"<<<<<<<
<<
Temporary merge branch 1\n" \
"Put into a pot three quarts of water, THREE ONIONS CUT SMALL, one\n" \
"||||||| merged common ancestors\n" \
"|||||||
||
merged common ancestors\n" \
"Put into a pot three quarts of water, three onions cut small, one\n" \
"=======\n" \
"=======
==
\n" \
"PUT INTO A POT three quarts of water, three onions cut small, one\n" \
">>>>>>> Temporary merge branch 2\n" \
">>>>>>>
>>
Temporary merge branch 2\n" \
"=======\n" \
"Put Into A Pot Three Quarts of Water, Three Onions Cut Small, One\n" \
">>>>>>> branchH-2\n" \
...
...
tests/merge/trees/recursive.c
View file @
9d8510b3
...
...
@@ -312,7 +312,7 @@ void test_merge_trees_recursive__conflicting_merge_base(void)
{
0100644
,
"4b7c5650008b2e747fe1809eeb5a1dde0e80850a"
,
0
,
"bouilli.txt"
},
{
0100644
,
"c4e6cca3ec6ae0148ed231f97257df8c311e015f"
,
0
,
"gravy.txt"
},
{
0100644
,
"68af1fc7407fd9addf1701a87eb1c95c7494c598"
,
0
,
"oyster.txt"
},
{
0100644
,
"
3a66812fed1e03ea4a6a7ee28d8a57aec1ca6537
"
,
1
,
"veal.txt"
},
{
0100644
,
"
ba5714aa3d5aebfd8e19d19cb1ddcfda63426a44
"
,
1
,
"veal.txt"
},
{
0100644
,
"d604c75019c282144bdbbf3fd3462ba74b240efc"
,
2
,
"veal.txt"
},
{
0100644
,
"37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc"
,
3
,
"veal.txt"
},
};
...
...
@@ -339,7 +339,7 @@ void test_merge_trees_recursive__conflicting_merge_base_with_diff3(void)
{
0100644
,
"4b7c5650008b2e747fe1809eeb5a1dde0e80850a"
,
0
,
"bouilli.txt"
},
{
0100644
,
"c4e6cca3ec6ae0148ed231f97257df8c311e015f"
,
0
,
"gravy.txt"
},
{
0100644
,
"68af1fc7407fd9addf1701a87eb1c95c7494c598"
,
0
,
"oyster.txt"
},
{
0100644
,
"
cd17a91513f3aee9e44114d1ede67932dd41d2fc
"
,
1
,
"veal.txt"
},
{
0100644
,
"
adb1bf17d112a0b4ecbd4e75bef6db3335d8ddcf
"
,
1
,
"veal.txt"
},
{
0100644
,
"d604c75019c282144bdbbf3fd3462ba74b240efc"
,
2
,
"veal.txt"
},
{
0100644
,
"37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc"
,
3
,
"veal.txt"
},
};
...
...
tests/merge/workdir/recursive.c
View file @
9d8510b3
...
...
@@ -44,7 +44,7 @@ void test_merge_workdir_recursive__writes_conflict_with_virtual_base(void)
cl_git_pass
(
git_futils_readbuffer
(
&
conflicting_buf
,
"merge-recursive/veal.txt"
));
cl_assert_equal_s
(
CONFLICTING_RECURSIVE_F1_TO_F2
,
conflicting_buf
.
ptr
);
git_index_free
(
index
);
git_buf_free
(
&
conflicting_buf
);
}
...
...
@@ -62,7 +62,7 @@ void test_merge_workdir_recursive__conflicting_merge_base_with_diff3(void)
{
0100644
,
"4b7c5650008b2e747fe1809eeb5a1dde0e80850a"
,
0
,
"bouilli.txt"
},
{
0100644
,
"c4e6cca3ec6ae0148ed231f97257df8c311e015f"
,
0
,
"gravy.txt"
},
{
0100644
,
"68af1fc7407fd9addf1701a87eb1c95c7494c598"
,
0
,
"oyster.txt"
},
{
0100644
,
"
cd17a91513f3aee9e44114d1ede67932dd41d2fc
"
,
1
,
"veal.txt"
},
{
0100644
,
"
adb1bf17d112a0b4ecbd4e75bef6db3335d8ddcf
"
,
1
,
"veal.txt"
},
{
0100644
,
"d604c75019c282144bdbbf3fd3462ba74b240efc"
,
2
,
"veal.txt"
},
{
0100644
,
"37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc"
,
3
,
"veal.txt"
},
};
...
...
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