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
2854e619
Commit
2854e619
authored
Jan 14, 2017
by
Carlos Martín Nieto
Committed by
GitHub
Jan 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4061 from libgit2/ethomson/merge_opts
merge: set default rename threshold
parents
a6d833a2
07bb8078
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
5 deletions
+12
-5
CHANGELOG.md
+4
-0
include/git2/merge.h
+2
-1
src/merge.c
+4
-4
tests/merge/trees/renames.c
+2
-0
No files found.
CHANGELOG.md
View file @
2854e619
...
...
@@ -3,6 +3,10 @@ v0.25 + 1
### Changes or improvements
*
`GIT_MERGE_OPTIONS_INIT`
now includes a setting to perform rename detection.
This aligns this structure with the default by
`git_merge`
and
`git_merge_trees`
when
`NULL`
was provided for the options.
### API additions
### API removals
...
...
include/git2/merge.h
View file @
2854e619
...
...
@@ -290,7 +290,8 @@ typedef struct {
}
git_merge_options
;
#define GIT_MERGE_OPTIONS_VERSION 1
#define GIT_MERGE_OPTIONS_INIT {GIT_MERGE_OPTIONS_VERSION}
#define GIT_MERGE_OPTIONS_INIT { \
GIT_MERGE_OPTIONS_VERSION, GIT_MERGE_FIND_RENAMES }
/**
* Initializes a `git_merge_options` with default values. Equivalent to
...
...
src/merge.c
View file @
2854e619
...
...
@@ -1713,15 +1713,15 @@ static int merge_normalize_opts(
if
((
error
=
git_repository_config__weakptr
(
&
cfg
,
repo
))
<
0
)
return
error
;
if
(
given
!=
NULL
)
if
(
given
!=
NULL
)
{
memcpy
(
opts
,
given
,
sizeof
(
git_merge_options
));
else
{
}
else
{
git_merge_options
init
=
GIT_MERGE_OPTIONS_INIT
;
memcpy
(
opts
,
&
init
,
sizeof
(
init
));
}
opts
->
flags
=
GIT_MERGE_FIND_RENAMES
;
if
((
opts
->
flags
&
GIT_MERGE_FIND_RENAMES
)
&&
!
opts
->
rename_threshold
)
opts
->
rename_threshold
=
GIT_MERGE_DEFAULT_RENAME_THRESHOLD
;
}
if
(
given
&&
given
->
default_driver
)
{
opts
->
default_driver
=
git__strdup
(
given
->
default_driver
);
...
...
tests/merge/trees/renames.c
View file @
2854e619
...
...
@@ -242,6 +242,8 @@ void test_merge_trees_renames__no_rename_index(void)
{
0100644
,
"b69fe837e4cecfd4c9a40cdca7c138468687df07"
,
3
,
"7-both-renamed.txt"
},
};
opts
.
flags
&=
~
GIT_MERGE_FIND_RENAMES
;
cl_git_pass
(
merge_trees_from_branches
(
&
index
,
repo
,
BRANCH_RENAME_OURS
,
BRANCH_RENAME_THEIRS
,
&
opts
));
...
...
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