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
4fd89fa0
Commit
4fd89fa0
authored
Jul 26, 2011
by
schu
Committed by
Vicent Marti
Nov 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs: add test case checking "immutable" references
Signed-off-by: schu <schu-github@schulog.org>
parent
a46ec457
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
tests/t10-refs.c
+32
-0
No files found.
tests/t10-refs.c
View file @
4fd89fa0
...
...
@@ -808,6 +808,37 @@ BEGIN_TEST(delete0, "deleting a ref which is both packed and loose should remove
close_temp_repo
(
repo
);
END_TEST
BEGIN_TEST
(
delete1
,
"can delete a just packed reference"
)
git_reference
*
ref
;
git_repository
*
repo
;
git_oid
id
;
const
char
*
new_ref
=
"refs/heads/new_ref"
;
git_oid_fromstr
(
&
id
,
current_master_tip
);
must_pass
(
open_temp_repo
(
&
repo
,
REPOSITORY_FOLDER
));
/* Create and write the new object id reference */
must_pass
(
git_reference_create_oid
(
&
ref
,
repo
,
new_ref
,
&
id
,
0
));
/* Lookup the reference */
must_pass
(
git_reference_lookup
(
&
ref
,
repo
,
new_ref
));
/* Ensure it's a loose reference */
must_be_true
(
git_reference_is_packed
(
ref
)
==
0
);
/* Pack all existing references */
must_pass
(
git_reference_packall
(
repo
));
/* Ensure it's a packed reference */
must_be_true
(
git_reference_is_packed
(
ref
)
==
1
);
/* This should pass */
must_pass
(
git_reference_delete
(
ref
));
close_temp_repo
(
repo
);
END_TEST
static
int
ensure_refname_normalized
(
int
is_oid_ref
,
const
char
*
input_refname
,
const
char
*
expected_refname
)
{
int
error
=
GIT_SUCCESS
;
...
...
@@ -1172,6 +1203,7 @@ BEGIN_SUITE(refs)
ADD_TEST
(
rename9
);
ADD_TEST
(
delete0
);
ADD_TEST
(
delete1
);
ADD_TEST
(
list0
);
ADD_TEST
(
list1
);
...
...
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