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
8e29fa38
Commit
8e29fa38
authored
Mar 13, 2022
by
Iliyas Jorio
Committed by
Edward Thomson
Apr 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add test that regenerates patches with spaces in filename
This currently crashes, proposed fix in subsequent commit.
parent
c9360912
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
tests/diff/parse.c
+26
-0
tests/patch/patch_common.h
+9
-0
No files found.
tests/diff/parse.c
View file @
8e29fa38
...
...
@@ -431,6 +431,32 @@ void test_diff_parse__new_file_with_space(void)
git_diff_free
(
diff
);
}
void
test_diff_parse__new_file_with_space_and_regenerate_patch
(
void
)
{
const
char
*
content
=
PATCH_ORIGINAL_NEW_FILE_WITH_SPACE
;
git_diff
*
diff
=
NULL
;
git_buf
buf
=
GIT_BUF_INIT
;
cl_git_pass
(
git_diff_from_buffer
(
&
diff
,
content
,
strlen
(
content
)));
cl_git_pass
(
git_diff_to_buf
(
&
buf
,
diff
,
GIT_DIFF_FORMAT_PATCH
));
git_buf_dispose
(
&
buf
);
git_diff_free
(
diff
);
}
void
test_diff_parse__delete_file_with_space_and_regenerate_patch
(
void
)
{
const
char
*
content
=
PATCH_DELETE_FILE_WITH_SPACE
;
git_diff
*
diff
=
NULL
;
git_buf
buf
=
GIT_BUF_INIT
;
cl_git_pass
(
git_diff_from_buffer
(
&
diff
,
content
,
strlen
(
content
)));
cl_git_pass
(
git_diff_to_buf
(
&
buf
,
diff
,
GIT_DIFF_FORMAT_PATCH
));
git_buf_dispose
(
&
buf
);
git_diff_free
(
diff
);
}
void
test_diff_parse__crlf
(
void
)
{
const
char
*
text
=
PATCH_CRLF
;
...
...
tests/patch/patch_common.h
View file @
8e29fa38
...
...
@@ -933,6 +933,15 @@
"@@ -0,0 +1 @@\n" \
"+a\n"
#define PATCH_DELETE_FILE_WITH_SPACE \
"diff --git a/sp ace.txt b/sp ace.txt\n" \
"deleted file mode 100644\n" \
"index 789819226..000000000\n" \
"--- a/sp ace.txt\n" \
"+++ /dev/null\n" \
"@@ -1 +0,0 @@\n" \
"-a\n"
#define PATCH_CRLF \
"diff --git a/test-file b/test-file\r\n" \
"new file mode 100644\r\n" \
...
...
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