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
3b334075
Commit
3b334075
authored
Jun 17, 2013
by
Edward Thomson
Committed by
Russell Belfer
Jun 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test illustrating tri-cyclic rename failure
parent
f0f2ff9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
tests-clar/diff/rename.c
+53
-0
No files found.
tests-clar/diff/rename.c
View file @
3b334075
...
...
@@ -650,6 +650,59 @@ void test_diff_rename__file_exchange(void)
git_buf_free
(
&
c2
);
}
void
test_diff_rename__file_exchange_three
(
void
)
{
git_buf
c1
=
GIT_BUF_INIT
,
c2
=
GIT_BUF_INIT
,
c3
=
GIT_BUF_INIT
;
git_index
*
index
;
git_tree
*
tree
;
git_diff_list
*
diff
;
git_diff_options
diffopts
=
GIT_DIFF_OPTIONS_INIT
;
git_diff_find_options
opts
=
GIT_DIFF_FIND_OPTIONS_INIT
;
diff_expects
exp
;
cl_git_pass
(
git_futils_readbuffer
(
&
c1
,
"renames/untimely.txt"
));
cl_git_pass
(
git_futils_readbuffer
(
&
c2
,
"renames/songof7cities.txt"
));
cl_git_pass
(
git_futils_readbuffer
(
&
c3
,
"renames/ikeepsix.txt"
));
cl_git_pass
(
git_futils_writebuffer
(
&
c1
,
"renames/ikeepsix.txt"
,
0
,
0
));
cl_git_pass
(
git_futils_writebuffer
(
&
c2
,
"renames/untimely.txt"
,
0
,
0
));
cl_git_pass
(
git_futils_writebuffer
(
&
c3
,
"renames/songof7cities.txt"
,
0
,
0
));
cl_git_pass
(
git_revparse_single
((
git_object
**
)
&
tree
,
g_repo
,
"HEAD^{tree}"
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_index_read_tree
(
index
,
tree
));
cl_git_pass
(
git_index_add_bypath
(
index
,
"songof7cities.txt"
));
cl_git_pass
(
git_index_add_bypath
(
index
,
"untimely.txt"
));
cl_git_pass
(
git_index_add_bypath
(
index
,
"ikeepsix.txt"
));
cl_git_pass
(
git_diff_tree_to_index
(
&
diff
,
g_repo
,
tree
,
index
,
&
diffopts
));
memset
(
&
exp
,
0
,
sizeof
(
exp
));
cl_git_pass
(
git_diff_foreach
(
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
));
cl_assert_equal_i
(
3
,
exp
.
files
);
cl_assert_equal_i
(
3
,
exp
.
file_status
[
GIT_DELTA_MODIFIED
]);
opts
.
flags
=
GIT_DIFF_FIND_ALL
;
cl_git_pass
(
git_diff_find_similar
(
diff
,
&
opts
));
memset
(
&
exp
,
0
,
sizeof
(
exp
));
cl_git_pass
(
git_diff_foreach
(
diff
,
diff_file_cb
,
diff_hunk_cb
,
diff_line_cb
,
&
exp
));
cl_assert_equal_i
(
3
,
exp
.
files
);
cl_assert_equal_i
(
3
,
exp
.
file_status
[
GIT_DELTA_RENAMED
]);
git_diff_list_free
(
diff
);
git_tree_free
(
tree
);
git_index_free
(
index
);
git_buf_free
(
&
c1
);
git_buf_free
(
&
c2
);
git_buf_free
(
&
c3
);
}
void
test_diff_rename__file_partial_exchange
(
void
)
{
git_buf
c1
=
GIT_BUF_INIT
,
c2
=
GIT_BUF_INIT
;
...
...
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