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
fd21c6f6
Commit
fd21c6f6
authored
May 29, 2011
by
schu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case checking we do not corrupt the repository when renaming
Signed-off-by: schu <schu-github@schulog.org>
parent
602ee38b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
tests/t10-refs.c
+33
-0
No files found.
tests/t10-refs.c
View file @
fd21c6f6
...
...
@@ -654,6 +654,38 @@ BEGIN_TEST(rename5, "can force-rename a reference with the name of an existing r
close_temp_repo
(
repo
);
END_TEST
static
const
char
*
ref_one_name
=
"refs/heads/one/branch"
;
static
const
char
*
ref_one_name_new
=
"refs/heads/two/branch"
;
static
const
char
*
ref_two_name
=
"refs/heads/two"
;
BEGIN_TEST
(
rename6
,
"can not overwrite name of existing reference"
)
git_reference
*
ref
,
*
ref_one
,
*
ref_one_new
,
*
ref_two
;
git_repository
*
repo
;
git_oid
id
;
must_pass
(
open_temp_repo
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_reference_lookup
(
&
ref
,
repo
,
ref_master_name
));
must_be_true
(
ref
->
type
&
GIT_REF_OID
);
git_oid_cpy
(
&
id
,
git_reference_oid
(
ref
));
/* Create loose references */
must_pass
(
git_reference_create_oid
(
&
ref_one
,
repo
,
ref_one_name
,
&
id
));
must_pass
(
git_reference_create_oid
(
&
ref_two
,
repo
,
ref_two_name
,
&
id
));
/* Pack everything */
must_pass
(
git_reference_packall
(
repo
));
/* Attempt to create illegal reference */
must_fail
(
git_reference_create_oid
(
&
ref_one_new
,
repo
,
ref_one_name_new
,
&
id
));
/* Illegal reference couldn't be created so this is supposed to fail */
must_fail
(
git_reference_lookup
(
&
ref_one_new
,
repo
,
ref_one_name_new
));
close_temp_repo
(
repo
);
END_TEST
BEGIN_TEST
(
delete0
,
"deleting a ref which is both packed and loose should remove both tracks in the filesystem"
)
git_reference
*
looked_up_ref
,
*
another_looked_up_ref
;
git_repository
*
repo
;
...
...
@@ -935,6 +967,7 @@ BEGIN_SUITE(refs)
ADD_TEST
(
rename3
);
ADD_TEST
(
rename4
);
ADD_TEST
(
rename5
);
ADD_TEST
(
rename6
);
ADD_TEST
(
delete0
);
ADD_TEST
(
list0
);
...
...
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