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
2b9b99b6
Commit
2b9b99b6
authored
Mar 29, 2011
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test ensuring one can not create an oid reference which targets at an unknown id
parent
4d00dfd4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
tests/t10-refs.c
+21
-0
No files found.
tests/t10-refs.c
View file @
2b9b99b6
...
...
@@ -292,6 +292,26 @@ BEGIN_TEST(create2, "create a new OID reference")
git_repository_free
(
repo
);
END_TEST
BEGIN_TEST
(
create3
,
"Can not create a new OID reference which targets at an unknown id"
)
git_reference
*
new_reference
,
*
looked_up_ref
;
git_repository
*
repo
;
git_oid
id
;
const
char
*
new_head
=
"refs/heads/new-head"
;
git_oid_mkstr
(
&
id
,
"deadbeef3f795b2b4353bcce3a527ad0a4f7f644"
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
/* Create and write the new object id reference */
must_fail
(
git_reference_create_oid
(
&
new_reference
,
repo
,
new_head
,
&
id
));
/* Ensure the reference can't be looked-up... */
must_fail
(
git_reference_lookup
(
&
looked_up_ref
,
repo
,
new_head
));
git_repository_free
(
repo
);
END_TEST
static
const
char
*
ref_name
=
"refs/heads/other"
;
static
const
char
*
ref_master_name
=
"refs/heads/master"
;
static
const
char
*
ref_branch_name
=
"refs/heads/branch"
;
...
...
@@ -889,6 +909,7 @@ BEGIN_SUITE(refs)
ADD_TEST
(
create0
);
ADD_TEST
(
create1
);
ADD_TEST
(
create2
);
ADD_TEST
(
create3
);
ADD_TEST
(
overwrite0
);
ADD_TEST
(
overwrite1
);
...
...
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