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
b93b74b9
Commit
b93b74b9
authored
Apr 11, 2016
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3737 from ethomson/strict-object
Strict object creation in `refs::create`
parents
69723dd8
d22a8b95
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
tests/refs/create.c
+5
-5
tests/reset/hard.c
+3
-3
No files found.
tests/refs/create.c
View file @
b93b74b9
...
@@ -19,7 +19,7 @@ void test_refs_create__cleanup(void)
...
@@ -19,7 +19,7 @@ void test_refs_create__cleanup(void)
{
{
cl_git_sandbox_cleanup
();
cl_git_sandbox_cleanup
();
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
,
0
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
,
1
));
}
}
void
test_refs_create__symbolic
(
void
)
void
test_refs_create__symbolic
(
void
)
...
@@ -122,7 +122,7 @@ void test_refs_create__oid(void)
...
@@ -122,7 +122,7 @@ void test_refs_create__oid(void)
}
}
/* Can by default create a reference that targets at an unknown id */
/* Can by default create a reference that targets at an unknown id */
void
test_refs_create__oid_unknown_succeeds_
by_defaul
t
(
void
)
void
test_refs_create__oid_unknown_succeeds_
without_stric
t
(
void
)
{
{
git_reference
*
new_reference
,
*
looked_up_ref
;
git_reference
*
new_reference
,
*
looked_up_ref
;
git_oid
id
;
git_oid
id
;
...
@@ -131,6 +131,8 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
...
@@ -131,6 +131,8 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
git_oid_fromstr
(
&
id
,
"deadbeef3f795b2b4353bcce3a527ad0a4f7f644"
);
git_oid_fromstr
(
&
id
,
"deadbeef3f795b2b4353bcce3a527ad0a4f7f644"
);
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
,
0
));
/* Create and write the new object id reference */
/* Create and write the new object id reference */
cl_git_pass
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
,
NULL
));
cl_git_pass
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
,
NULL
));
git_reference_free
(
new_reference
);
git_reference_free
(
new_reference
);
...
@@ -141,7 +143,7 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
...
@@ -141,7 +143,7 @@ void test_refs_create__oid_unknown_succeeds_by_default(void)
}
}
/* Strict object enforcement enforces valid object id */
/* Strict object enforcement enforces valid object id */
void
test_refs_create__oid_unknown_fails_
strict_mode
(
void
)
void
test_refs_create__oid_unknown_fails_
by_default
(
void
)
{
{
git_reference
*
new_reference
,
*
looked_up_ref
;
git_reference
*
new_reference
,
*
looked_up_ref
;
git_oid
id
;
git_oid
id
;
...
@@ -150,8 +152,6 @@ void test_refs_create__oid_unknown_fails_strict_mode(void)
...
@@ -150,8 +152,6 @@ void test_refs_create__oid_unknown_fails_strict_mode(void)
git_oid_fromstr
(
&
id
,
"deadbeef3f795b2b4353bcce3a527ad0a4f7f644"
);
git_oid_fromstr
(
&
id
,
"deadbeef3f795b2b4353bcce3a527ad0a4f7f644"
);
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
,
1
));
/* Create and write the new object id reference */
/* Create and write the new object id reference */
cl_git_fail
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
,
NULL
));
cl_git_fail
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
,
NULL
));
...
...
tests/reset/hard.c
View file @
b93b74b9
...
@@ -122,9 +122,9 @@ static void unmerged_index_init(git_index *index, int entries)
...
@@ -122,9 +122,9 @@ static void unmerged_index_init(git_index *index, int entries)
int
write_theirs
=
4
;
int
write_theirs
=
4
;
git_oid
ancestor
,
ours
,
theirs
;
git_oid
ancestor
,
ours
,
theirs
;
git_oid_fromstr
(
&
ancestor
,
"
6bb0d9f700543ba3d318ba7075fc3bd696b4287b
"
);
git_oid_fromstr
(
&
ancestor
,
"
452e4244b5d083ddf0460acf1ecc74db9dcfa11a
"
);
git_oid_fromstr
(
&
ours
,
"
b19a1e93bec1317dc6097229e12afaffbfa74dc2
"
);
git_oid_fromstr
(
&
ours
,
"
32504b727382542f9f089e24fddac5e78533e96c
"
);
git_oid_fromstr
(
&
theirs
,
"
950b81b7eee953d050aa05a641f8e056c85dd1bd
"
);
git_oid_fromstr
(
&
theirs
,
"
061d42a44cacde5726057b67558821d95db96f19
"
);
cl_git_rewritefile
(
"status/conflicting_file"
,
"conflicting file
\n
"
);
cl_git_rewritefile
(
"status/conflicting_file"
,
"conflicting file
\n
"
);
...
...
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