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
f0f2ff9c
Commit
f0f2ff9c
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 failure when renames produce similar similarities
parent
ffb762fe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
0 deletions
+81
-0
tests-clar/diff/rename.c
+70
-0
tests-clar/resources/renames/.gitted/objects/17/58bdd7c16a72ff7c17d8de0c957ced3ccad645
+6
-0
tests-clar/resources/renames/.gitted/objects/50/e90273af7d826ff0a95865bcd3ba8412c447d9
+4
-0
tests-clar/resources/renames/.gitted/objects/b9/25b224cc91f897001a9993fbce169fdaa8858f
+0
-0
tests-clar/resources/renames/.gitted/objects/ea/c43f5195a2cee53b7458d8dad16aedde10711b
+0
-0
tests-clar/resources/renames/.gitted/refs/heads/renames_similar_two
+1
-0
No files found.
tests-clar/diff/rename.c
View file @
f0f2ff9c
...
...
@@ -908,6 +908,76 @@ void test_diff_rename__rejected_match_can_match_others(void)
git_buf_free
(
&
two
);
}
static
void
write_similarity_file_two
(
const
char
*
filename
,
size_t
b_lines
)
{
git_buf
contents
=
GIT_BUF_INIT
;
size_t
i
;
for
(
i
=
0
;
i
<
b_lines
;
i
++
)
git_buf_printf
(
&
contents
,
"%0.2d - bbbbb
\r\n
"
,
(
i
+
1
));
for
(
i
=
b_lines
;
i
<
50
;
i
++
)
git_buf_printf
(
&
contents
,
"%0.2d - aaaaa%s"
,
(
i
+
1
),
(
i
==
49
?
""
:
"
\r\n
"
));
cl_git_pass
(
git_futils_writebuffer
(
&
contents
,
filename
,
O_RDWR
|
O_CREAT
,
0777
));
git_buf_free
(
&
contents
);
}
void
test_diff_rename__rejected_match_can_match_others_two
(
void
)
{
git_reference
*
head
,
*
selfsimilar
;
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
;
const
char
*
sources
[]
=
{
"a.txt"
,
"b.txt"
};
const
char
*
targets
[]
=
{
"c.txt"
,
"d.txt"
};
struct
rename_expected
expect
=
{
2
,
sources
,
targets
};
opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_symbolic_set_target
(
&
selfsimilar
,
head
,
"refs/heads/renames_similar_two"
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
p_unlink
(
"renames/a.txt"
));
cl_git_pass
(
p_unlink
(
"renames/b.txt"
));
cl_git_pass
(
git_index_remove_bypath
(
index
,
"a.txt"
));
cl_git_pass
(
git_index_remove_bypath
(
index
,
"b.txt"
));
write_similarity_file_two
(
"renames/c.txt"
,
7
);
write_similarity_file_two
(
"renames/d.txt"
,
8
);
cl_git_pass
(
git_index_add_bypath
(
index
,
"c.txt"
));
cl_git_pass
(
git_index_add_bypath
(
index
,
"d.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
));
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
>
0
);
git_diff_list_free
(
diff
);
git_tree_free
(
tree
);
git_index_free
(
index
);
git_reference_free
(
head
);
git_reference_free
(
selfsimilar
);
}
void
test_diff_rename__case_changes_are_split
(
void
)
{
git_index
*
index
;
...
...
tests-clar/resources/renames/.gitted/objects/17/58bdd7c16a72ff7c17d8de0c957ced3ccad645
0 → 100644
View file @
f0f2ff9c
File added
tests-clar/resources/renames/.gitted/objects/50/e90273af7d826ff0a95865bcd3ba8412c447d9
0 → 100644
View file @
f0f2ff9c
File added
tests-clar/resources/renames/.gitted/objects/b9/25b224cc91f897001a9993fbce169fdaa8858f
0 → 100644
View file @
f0f2ff9c
File added
tests-clar/resources/renames/.gitted/objects/ea/c43f5195a2cee53b7458d8dad16aedde10711b
0 → 100644
View file @
f0f2ff9c
File added
tests-clar/resources/renames/.gitted/refs/heads/renames_similar_two
0 → 100644
View file @
f0f2ff9c
50e90273af7d826ff0a95865bcd3ba8412c447d9
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