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
628e92cd
Commit
628e92cd
authored
Dec 05, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use weird return codes
parent
c56c6d69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
src/diff_tform.c
+8
-3
tests/diff/rename.c
+3
-0
No files found.
src/diff_tform.c
View file @
628e92cd
...
@@ -293,8 +293,9 @@ static int normalize_find_opts(
...
@@ -293,8 +293,9 @@ static int normalize_find_opts(
if
(
git_config_get_string
(
&
val
,
cfg
,
"diff.renames"
)
<
0
)
if
(
git_config_get_string
(
&
val
,
cfg
,
"diff.renames"
)
<
0
)
giterr_clear
();
giterr_clear
();
else
if
(
val
)
{
else
if
(
val
)
{
if
(
!
strcasecmp
(
val
,
"false"
))
int
boolval
;
return
GIT_PASSTHROUGH
;
if
(
!
git__parse_bool
(
&
boolval
,
val
)
&&
!
boolval
)
opts
->
flags
=
0
;
else
if
(
!
strcasecmp
(
val
,
"copies"
)
||
!
strcasecmp
(
val
,
"copy"
))
else
if
(
!
strcasecmp
(
val
,
"copies"
)
||
!
strcasecmp
(
val
,
"copy"
))
opts
->
flags
=
GIT_DIFF_FIND_RENAMES
|
GIT_DIFF_FIND_COPIES
;
opts
->
flags
=
GIT_DIFF_FIND_RENAMES
|
GIT_DIFF_FIND_COPIES
;
else
else
...
@@ -834,7 +835,11 @@ int git_diff_find_similar(
...
@@ -834,7 +835,11 @@ int git_diff_find_similar(
git_diff_file
swap
;
git_diff_file
swap
;
if
((
error
=
normalize_find_opts
(
diff
,
&
opts
,
given_opts
))
<
0
)
if
((
error
=
normalize_find_opts
(
diff
,
&
opts
,
given_opts
))
<
0
)
return
(
error
==
GIT_PASSTHROUGH
)
?
0
:
error
;
return
error
;
/* No flags set; nothing to do */
if
((
opts
.
flags
&
GIT_DIFF_FIND_ALL
)
==
0
)
return
0
;
num_deltas
=
diff
->
deltas
.
length
;
num_deltas
=
diff
->
deltas
.
length
;
...
...
tests/diff/rename.c
View file @
628e92cd
...
@@ -919,6 +919,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
...
@@ -919,6 +919,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
char
*
ptr
;
char
*
ptr
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
findopts
.
flags
=
GIT_DIFF_FIND_RENAMES
;
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_symbolic_set_target
(
cl_git_pass
(
git_reference_symbolic_set_target
(
...
@@ -1003,6 +1004,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
...
@@ -1003,6 +1004,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
struct
rename_expected
expect
=
{
2
,
status
,
sources
,
targets
};
struct
rename_expected
expect
=
{
2
,
status
,
sources
,
targets
};
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
findopts
.
flags
=
GIT_DIFF_FIND_RENAMES
;
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_symbolic_set_target
(
cl_git_pass
(
git_reference_symbolic_set_target
(
...
@@ -1060,6 +1062,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
...
@@ -1060,6 +1062,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
struct
rename_expected
expect
=
{
2
,
status
,
sources
,
targets
};
struct
rename_expected
expect
=
{
2
,
status
,
sources
,
targets
};
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
findopts
.
flags
=
GIT_DIFF_FIND_RENAMES
;
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_symbolic_set_target
(
cl_git_pass
(
git_reference_symbolic_set_target
(
...
...
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