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
6716e2f3
Unverified
Commit
6716e2f3
authored
Oct 10, 2019
by
Patrick Steinhardt
Committed by
GitHub
Oct 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5248 from dlax/parse-patch-empty-files
patch_parse: handle patches with new empty files
parents
f04a58b0
b61810bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
src/patch_parse.c
+1
-0
tests/diff/parse.c
+20
-0
No files found.
src/patch_parse.c
View file @
6716e2f3
...
...
@@ -406,6 +406,7 @@ static const parse_header_transition transitions[] = {
/* Next patch */
{
"diff --git "
,
STATE_END
,
0
,
NULL
},
{
"@@ -"
,
STATE_END
,
0
,
NULL
},
{
"-- "
,
STATE_INDEX
,
0
,
NULL
},
{
"-- "
,
STATE_END
,
0
,
NULL
},
};
...
...
tests/diff/parse.c
View file @
6716e2f3
...
...
@@ -78,6 +78,26 @@ void test_diff_parse__exact_rename(void)
git_diff_free
(
diff
);
}
void
test_diff_parse__empty_file
(
void
)
{
const
char
*
content
=
"---
\n
"
" file | 0
\n
"
" 1 file changed, 0 insertions(+), 0 deletions(-)
\n
"
" created mode 100644 file
\n
"
"
\n
"
"diff --git a/file b/file
\n
"
"new file mode 100644
\n
"
"index 0000000..e69de29
\n
"
"--
\n
"
"2.20.1
\n
"
;
git_diff
*
diff
;
cl_git_pass
(
git_diff_from_buffer
(
&
diff
,
content
,
strlen
(
content
)));
git_diff_free
(
diff
);
}
void
test_diff_parse__invalid_patches_fails
(
void
)
{
test_parse_invalid_diff
(
PATCH_CORRUPT_MISSING_NEW_FILE
);
...
...
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