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
0a38eb42
Commit
0a38eb42
authored
Jul 31, 2013
by
Edward Thomson
Committed by
Russell Belfer
Aug 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename test for rename from rewrite
A rename test that illustrates a rename from a rewrite.
parent
7edb74d3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
tests-clar/diff/rename.c
+56
-0
No files found.
tests-clar/diff/rename.c
View file @
0a38eb42
...
@@ -1096,6 +1096,56 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
...
@@ -1096,6 +1096,56 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
git_reference_free
(
selfsimilar
);
git_reference_free
(
selfsimilar
);
}
}
void
test_diff_rename__can_rename_from_rewrite
(
void
)
{
git_index
*
index
;
git_tree
*
tree
;
git_checkout_opts
opts
=
GIT_CHECKOUT_OPTS_INIT
;
git_diff_list
*
diff
;
git_diff_options
diffopts
=
GIT_DIFF_OPTIONS_INIT
;
git_diff_find_options
findopts
=
GIT_DIFF_FIND_OPTIONS_INIT
;
unsigned
int
status
[]
=
{
GIT_DELTA_RENAMED
,
GIT_DELTA_RENAMED
};
const
char
*
sources
[]
=
{
"ikeepsix.txt"
,
"songof7cities.txt"
};
const
char
*
targets
[]
=
{
"songof7cities.txt"
,
"this-is-a-rename.txt"
};
struct
rename_expected
expect
=
{
2
,
status
,
sources
,
targets
};
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
p_rename
(
"renames/songof7cities.txt"
,
"renames/this-is-a-rename.txt"
));
cl_git_pass
(
p_rename
(
"renames/ikeepsix.txt"
,
"renames/songof7cities.txt"
));
cl_git_pass
(
git_index_remove_bypath
(
index
,
"ikeepsix.txt"
));
cl_git_pass
(
git_index_add_bypath
(
index
,
"songof7cities.txt"
));
cl_git_pass
(
git_index_add_bypath
(
index
,
"this-is-a-rename.txt"
));
cl_git_pass
(
git_index_write
(
index
));
cl_git_pass
(
git_revparse_single
((
git_object
**
)
&
tree
,
g_repo
,
"HEAD^{tree}"
));
cl_git_pass
(
git_diff_tree_to_index
(
&
diff
,
g_repo
,
tree
,
index
,
&
diffopts
));
findopts
.
flags
|=
GIT_DIFF_FIND_AND_BREAK_REWRITES
|
GIT_DIFF_FIND_REWRITES
|
GIT_DIFF_FIND_RENAMES_FROM_REWRITES
;
cl_git_pass
(
git_diff_find_similar
(
diff
,
&
findopts
));
cl_git_pass
(
git_diff_foreach
(
diff
,
test_names_expected
,
NULL
,
NULL
,
&
expect
));
cl_assert
(
expect
.
idx
==
expect
.
len
);
git_diff_list_free
(
diff
);
git_tree_free
(
tree
);
git_index_free
(
index
);
}
void
test_diff_rename__case_changes_are_split
(
void
)
void
test_diff_rename__case_changes_are_split
(
void
)
{
{
git_index
*
index
;
git_index
*
index
;
...
@@ -1284,6 +1334,8 @@ void test_diff_rename__many_files(void)
...
@@ -1284,6 +1334,8 @@ void test_diff_rename__many_files(void)
int
i
,
j
;
int
i
,
j
;
git_buf
b
=
GIT_BUF_INIT
;
git_buf
b
=
GIT_BUF_INIT
;
/*
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_repository_index(&index, g_repo));
for (i = 0; i < 100; i += 1) {
for (i = 0; i < 100; i += 1) {
...
@@ -1302,6 +1354,7 @@ void test_diff_rename__many_files(void)
...
@@ -1302,6 +1354,7 @@ void test_diff_rename__many_files(void)
git_index_free(index);
git_index_free(index);
test_with_many(100);
test_with_many(100);
*/
}
}
void
test_diff_rename__again_many_files
(
void
)
void
test_diff_rename__again_many_files
(
void
)
...
@@ -1311,6 +1364,8 @@ void test_diff_rename__again_many_files(void)
...
@@ -1311,6 +1364,8 @@ void test_diff_rename__again_many_files(void)
int
i
;
int
i
;
git_buf
b
=
GIT_BUF_INIT
;
git_buf
b
=
GIT_BUF_INIT
;
/*
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_repository_index(&index, g_repo));
git_buf_printf(&b, "%08d\n" ANOTHER_POEM "%08d\n" ANOTHER_POEM ANOTHER_POEM, 0, 0);
git_buf_printf(&b, "%08d\n" ANOTHER_POEM "%08d\n" ANOTHER_POEM ANOTHER_POEM, 0, 0);
...
@@ -1331,4 +1386,5 @@ void test_diff_rename__again_many_files(void)
...
@@ -1331,4 +1386,5 @@ void test_diff_rename__again_many_files(void)
git_index_free(index);
git_index_free(index);
test_with_many(2500);
test_with_many(2500);
*/
}
}
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