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
4e746d80
Commit
4e746d80
authored
Nov 05, 2018
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: ensure applying a patch can't delete a file twice
parent
f8b9493b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
tests/apply/apply_helpers.h
+34
-0
tests/apply/both.c
+11
-0
No files found.
tests/apply/apply_helpers.h
View file @
4e746d80
...
...
@@ -419,6 +419,40 @@
"@@ -0,0 +1 @@\n" \
"+New file.\n" \
#define DIFF_REMOVE_FILE_TWICE \
"diff --git a/asparagus.txt b/asparagus.txt\n" \
"deleted file mode 100644\n" \
"index f516580..0000000\n" \
"--- a/asparagus.txt\n" \
"+++ /dev/null\n" \
"@@ -1,10 +0,0 @@\n" \
"-ASPARAGUS SOUP!\n" \
"-\n" \
"-Take four large bunches of asparagus, scrape it nicely, cut off one inch\n" \
"-of the tops, and lay them in water, chop the stalks and put them on the\n" \
"-fire with a piece of bacon, a large onion cut up, and pepper and salt;\n" \
"-add two quarts of water, boil them till the stalks are quite soft, then\n" \
"-pulp them through a sieve, and strain the water to it, which must be put\n" \
"-back in the pot; put into it a chicken cut up, with the tops of\n" \
"-asparagus which had been laid by, boil it until these last articles are\n" \
"-sufficiently done, thicken with flour, butter and milk, and serve it up.\n" \
"diff --git a/asparagus.txt b/asparagus.txt\n" \
"deleted file mode 100644\n" \
"index f516580..0000000\n" \
"--- a/asparagus.txt\n" \
"+++ /dev/null\n" \
"@@ -1,10 +0,0 @@\n" \
"-ASPARAGUS SOUP!\n" \
"-\n" \
"-Take four large bunches of asparagus, scrape it nicely, cut off one inch\n" \
"-of the tops, and lay them in water, chop the stalks and put them on the\n" \
"-fire with a piece of bacon, a large onion cut up, and pepper and salt;\n" \
"-add two quarts of water, boil them till the stalks are quite soft, then\n" \
"-pulp them through a sieve, and strain the water to it, which must be put\n" \
"-back in the pot; put into it a chicken cut up, with the tops of\n" \
"-asparagus which had been laid by, boil it until these last articles are\n" \
"-sufficiently done, thicken with flour, butter and milk, and serve it up.\n"
struct
iterator_compare_data
{
struct
merge_index_entry
*
expected
;
size_t
cnt
;
...
...
tests/apply/both.c
View file @
4e746d80
...
...
@@ -723,3 +723,14 @@ void test_apply_both__readd_deleted_file(void)
git_diff_free
(
diff
);
}
void
test_apply_both__cant_remove_file_twice
(
void
)
{
git_diff
*
diff
;
cl_git_pass
(
git_diff_from_buffer
(
&
diff
,
DIFF_REMOVE_FILE_TWICE
,
strlen
(
DIFF_REMOVE_FILE_TWICE
)));
cl_git_fail
(
git_apply
(
repo
,
diff
,
GIT_APPLY_LOCATION_BOTH
,
NULL
));
git_diff_free
(
diff
);
}
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