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
bae8bea0
Commit
bae8bea0
authored
Jan 29, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More index collision tests
parent
1eefd356
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
tests/index/collision.c
+64
-0
No files found.
tests/index/collision.c
View file @
bae8bea0
...
...
@@ -40,3 +40,67 @@ void test_index_collision__add(void)
git_tree_free
(
tree
);
git_index_free
(
index
);
}
void
test_index_collision__add_with_highstage_1
(
void
)
{
git_index
*
index
;
git_index_entry
entry
;
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"
;
entry
.
flags
=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create a blob beneath the previous tree entry */
entry
.
path
=
"a/b/c"
;
entry
.
flags
=
0
;
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create another tree entry above the blob */
entry
.
path
=
"a/b"
;
entry
.
flags
=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_index_free
(
index
);
}
void
test_index_collision__add_with_highstage_2
(
void
)
{
git_index
*
index
;
git_index_entry
entry
;
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/c"
;
entry
.
flags
=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create a blob beneath the previous tree entry */
entry
.
path
=
"a/b/c"
;
entry
.
flags
=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create another tree entry above the blob */
entry
.
path
=
"a/b"
;
entry
.
flags
=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
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