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
b30dab8f
Commit
b30dab8f
authored
Jul 11, 2019
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply: refactor to use a switch statement
parent
001d76e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
src/apply.c
+14
-10
No files found.
src/apply.c
View file @
b30dab8f
...
@@ -206,16 +206,20 @@ static int apply_hunk(
...
@@ -206,16 +206,20 @@ static int apply_hunk(
goto
done
;
goto
done
;
}
}
if
(
line
->
origin
==
GIT_DIFF_LINE_CONTEXT
||
switch
(
line
->
origin
)
{
line
->
origin
==
GIT_DIFF_LINE_DELETION
)
{
case
GIT_DIFF_LINE_CONTEXT
:
if
((
error
=
git_vector_insert
(
&
preimage
.
lines
,
line
))
<
0
)
if
((
error
=
git_vector_insert
(
&
preimage
.
lines
,
line
))
<
0
||
goto
done
;
(
error
=
git_vector_insert
(
&
postimage
.
lines
,
line
))
<
0
)
}
goto
done
;
break
;
if
(
line
->
origin
==
GIT_DIFF_LINE_CONTEXT
||
case
GIT_DIFF_LINE_DELETION
:
line
->
origin
==
GIT_DIFF_LINE_ADDITION
)
{
if
((
error
=
git_vector_insert
(
&
preimage
.
lines
,
line
))
<
0
)
if
((
error
=
git_vector_insert
(
&
postimage
.
lines
,
line
))
<
0
)
goto
done
;
goto
done
;
break
;
case
GIT_DIFF_LINE_ADDITION
:
if
((
error
=
git_vector_insert
(
&
postimage
.
lines
,
line
))
<
0
)
goto
done
;
break
;
}
}
}
}
...
...
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