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
95fbedcd
Commit
95fbedcd
authored
Jan 28, 2014
by
Russell Belfer
Committed by
Edward Thomson
Jan 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for blob/tree name collisions in index
parent
66af8449
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
tests/index/collision.c
+42
-0
No files found.
tests/index/collision.c
0 → 100644
View file @
95fbedcd
#include "clar_libgit2.h"
#include "git2/repository.h"
#include "git2/index.h"
git_repository
*
repo
=
NULL
;
void
test_index_collision__cleanup
(
void
)
{
cl_git_sandbox_cleanup
();
repo
=
NULL
;
}
void
test_index_collision__add
(
void
)
{
git_index
*
index
;
git_index_entry
entry
;
git_oid
tree_id
;
git_tree
*
tree
;
repo
=
cl_git_sandbox_init
(
"empty_standard_repo"
);
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
memset
(
&
entry
,
0
,
sizeof
(
entry
));
entry
.
ctime
.
seconds
=
12346789
;
entry
.
mtime
.
seconds
=
12346789
;
entry
.
mode
=
0100644
;
entry
.
file_size
=
0
;
git_oid_fromstr
(
&
entry
.
id
,
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
);
entry
.
path
=
"a/b"
;
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create a tree/blob collision */
entry
.
path
=
"a/b/c"
;
cl_git_fail
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_write_tree
(
&
tree_id
,
index
));
cl_git_pass
(
git_tree_lookup
(
&
tree
,
repo
,
&
tree_id
));
git_tree_free
(
tree
);
git_index_free
(
index
);
}
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