File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -206,16 +206,20 @@ static int apply_hunk(
206206 goto done ;
207207 }
208208
209- if (line -> origin == GIT_DIFF_LINE_CONTEXT ||
210- line -> origin == GIT_DIFF_LINE_DELETION ) {
211- if ((error = git_vector_insert (& preimage .lines , line )) < 0 )
212- goto done ;
213- }
214-
215- if (line -> origin == GIT_DIFF_LINE_CONTEXT ||
216- line -> origin == GIT_DIFF_LINE_ADDITION ) {
217- if ((error = git_vector_insert (& postimage .lines , line )) < 0 )
218- goto done ;
209+ switch (line -> origin ) {
210+ case GIT_DIFF_LINE_CONTEXT :
211+ if ((error = git_vector_insert (& preimage .lines , line )) < 0 ||
212+ (error = git_vector_insert (& postimage .lines , line )) < 0 )
213+ goto done ;
214+ break ;
215+ case GIT_DIFF_LINE_DELETION :
216+ if ((error = git_vector_insert (& preimage .lines , line )) < 0 )
217+ goto done ;
218+ break ;
219+ case GIT_DIFF_LINE_ADDITION :
220+ if ((error = git_vector_insert (& postimage .lines , line )) < 0 )
221+ goto done ;
222+ break ;
219223 }
220224 }
221225
You can’t perform that action at this time.
0 commit comments