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
b02bcd97
Commit
b02bcd97
authored
May 02, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Boom
parent
17f1c9fb
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
tests-clar/object/raw/write.c
+2
-2
tests-clar/refs/delete.c
+2
-2
tests-clar/refs/pack.c
+2
-2
tests-clar/refs/rename.c
+6
-6
tests-clar/repo/discover.c
+2
-2
No files found.
tests-clar/object/raw/write.c
View file @
b02bcd97
...
@@ -38,8 +38,8 @@ static void streaming_write(git_oid *oid, git_odb *odb, git_rawobj *raw)
...
@@ -38,8 +38,8 @@ static void streaming_write(git_oid *oid, git_odb *odb, git_rawobj *raw)
static
void
check_object_files
(
object_data
*
d
)
static
void
check_object_files
(
object_data
*
d
)
{
{
cl_
git_pass
(
git_path_exists
(
d
->
dir
));
cl_
assert
(
git_path_exists
(
d
->
dir
));
cl_
git_pass
(
git_path_exists
(
d
->
file
));
cl_
assert
(
git_path_exists
(
d
->
file
));
}
}
static
void
cmp_objects
(
git_rawobj
*
o1
,
git_rawobj
*
o2
)
static
void
cmp_objects
(
git_rawobj
*
o1
,
git_rawobj
*
o2
)
...
...
tests-clar/refs/delete.c
View file @
b02bcd97
...
@@ -31,7 +31,7 @@ void test_refs_delete__packed_loose(void)
...
@@ -31,7 +31,7 @@ void test_refs_delete__packed_loose(void)
/* Ensure the loose reference exists on the file system */
/* Ensure the loose reference exists on the file system */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
packed_test_head_name
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
packed_test_head_name
));
cl_
git_pass
(
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
git_path_exists
(
temp_path
.
ptr
));
/* Lookup the reference */
/* Lookup the reference */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
packed_test_head_name
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
packed_test_head_name
));
...
@@ -46,7 +46,7 @@ void test_refs_delete__packed_loose(void)
...
@@ -46,7 +46,7 @@ void test_refs_delete__packed_loose(void)
cl_git_fail
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
packed_test_head_name
));
cl_git_fail
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
packed_test_head_name
));
/* Ensure the loose reference doesn't exist any longer on the file system */
/* Ensure the loose reference doesn't exist any longer on the file system */
cl_
git_pass
(
!
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
!
git_path_exists
(
temp_path
.
ptr
));
git_reference_free
(
another_looked_up_ref
);
git_reference_free
(
another_looked_up_ref
);
git_buf_free
(
&
temp_path
);
git_buf_free
(
&
temp_path
);
...
...
tests-clar/refs/pack.c
View file @
b02bcd97
...
@@ -51,7 +51,7 @@ void test_refs_pack__loose(void)
...
@@ -51,7 +51,7 @@ void test_refs_pack__loose(void)
/* Ensure the packed-refs file exists */
/* Ensure the packed-refs file exists */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
GIT_PACKEDREFS_FILE
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
GIT_PACKEDREFS_FILE
));
cl_
git_pass
(
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
git_path_exists
(
temp_path
.
ptr
));
/* Ensure the known ref can still be looked up but is now packed */
/* Ensure the known ref can still be looked up but is now packed */
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
loose_tag_ref_name
));
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
loose_tag_ref_name
));
...
@@ -60,7 +60,7 @@ void test_refs_pack__loose(void)
...
@@ -60,7 +60,7 @@ void test_refs_pack__loose(void)
/* Ensure the known ref has been removed from the loose folder structure */
/* Ensure the known ref has been removed from the loose folder structure */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
loose_tag_ref_name
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
loose_tag_ref_name
));
cl_
git_pass
(
!
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
!
git_path_exists
(
temp_path
.
ptr
));
git_reference_free
(
reference
);
git_reference_free
(
reference
);
git_buf_free
(
&
temp_path
);
git_buf_free
(
&
temp_path
);
...
...
tests-clar/refs/rename.c
View file @
b02bcd97
...
@@ -38,7 +38,7 @@ void test_refs_rename__loose(void)
...
@@ -38,7 +38,7 @@ void test_refs_rename__loose(void)
/* Ensure the ref doesn't exist on the file system */
/* Ensure the ref doesn't exist on the file system */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
new_name
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
new_name
));
cl_
git_pass
(
!
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
!
git_path_exists
(
temp_path
.
ptr
));
/* Retrieval of the reference to rename */
/* Retrieval of the reference to rename */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
loose_tag_ref_name
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
loose_tag_ref_name
));
...
@@ -63,7 +63,7 @@ void test_refs_rename__loose(void)
...
@@ -63,7 +63,7 @@ void test_refs_rename__loose(void)
/* ...and the ref can be found in the file system */
/* ...and the ref can be found in the file system */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
new_name
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
new_name
));
cl_
git_pass
(
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
git_path_exists
(
temp_path
.
ptr
));
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
git_reference_free
(
another_looked_up_ref
);
git_reference_free
(
another_looked_up_ref
);
...
@@ -79,7 +79,7 @@ void test_refs_rename__packed(void)
...
@@ -79,7 +79,7 @@ void test_refs_rename__packed(void)
/* Ensure the ref doesn't exist on the file system */
/* Ensure the ref doesn't exist on the file system */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
packed_head_name
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
packed_head_name
));
cl_
git_pass
(
!
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
!
git_path_exists
(
temp_path
.
ptr
));
/* The reference can however be looked-up... */
/* The reference can however be looked-up... */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
packed_head_name
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
packed_head_name
));
...
@@ -104,7 +104,7 @@ void test_refs_rename__packed(void)
...
@@ -104,7 +104,7 @@ void test_refs_rename__packed(void)
/* ...and the ref now happily lives in the file system */
/* ...and the ref now happily lives in the file system */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
brand_new_name
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
brand_new_name
));
cl_
git_pass
(
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
git_path_exists
(
temp_path
.
ptr
));
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
git_reference_free
(
another_looked_up_ref
);
git_reference_free
(
another_looked_up_ref
);
...
@@ -120,7 +120,7 @@ void test_refs_rename__packed_doesnt_pack_others(void)
...
@@ -120,7 +120,7 @@ void test_refs_rename__packed_doesnt_pack_others(void)
/* Ensure the other reference exists on the file system */
/* Ensure the other reference exists on the file system */
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
packed_test_head_name
));
cl_git_pass
(
git_buf_joinpath
(
&
temp_path
,
g_repo
->
path_repository
,
packed_test_head_name
));
cl_
git_pass
(
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
git_path_exists
(
temp_path
.
ptr
));
/* Lookup the other reference */
/* Lookup the other reference */
cl_git_pass
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
packed_test_head_name
));
cl_git_pass
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
packed_test_head_name
));
...
@@ -145,7 +145,7 @@ void test_refs_rename__packed_doesnt_pack_others(void)
...
@@ -145,7 +145,7 @@ void test_refs_rename__packed_doesnt_pack_others(void)
cl_assert
(
git_reference_is_packed
(
another_looked_up_ref
)
==
0
);
cl_assert
(
git_reference_is_packed
(
another_looked_up_ref
)
==
0
);
/* Ensure the other ref still exists on the file system */
/* Ensure the other ref still exists on the file system */
cl_
git_pass
(
git_path_exists
(
temp_path
.
ptr
));
cl_
assert
(
git_path_exists
(
temp_path
.
ptr
));
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
git_reference_free
(
another_looked_up_ref
);
git_reference_free
(
another_looked_up_ref
);
...
...
tests-clar/repo/discover.c
View file @
b02bcd97
...
@@ -38,7 +38,7 @@ static void write_file(const char *path, const char *content)
...
@@ -38,7 +38,7 @@ static void write_file(const char *path, const char *content)
git_file
file
;
git_file
file
;
int
error
;
int
error
;
if
(
git_path_exists
(
path
)
==
GIT_SUCCESS
)
{
if
(
git_path_exists
(
path
))
{
cl_git_pass
(
p_unlink
(
path
));
cl_git_pass
(
p_unlink
(
path
));
}
}
...
@@ -82,7 +82,7 @@ void test_repo_discover__0(void)
...
@@ -82,7 +82,7 @@ void test_repo_discover__0(void)
append_ceiling_dir
(
&
ceiling_dirs_buf
,
TEMP_REPO_FOLDER
);
append_ceiling_dir
(
&
ceiling_dirs_buf
,
TEMP_REPO_FOLDER
);
ceiling_dirs
=
git_buf_cstr
(
&
ceiling_dirs_buf
);
ceiling_dirs
=
git_buf_cstr
(
&
ceiling_dirs_buf
);
cl_
assert
(
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
)
==
GIT_ENOTAREPO
);
cl_
git_fail
(
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
)
);
cl_git_pass
(
git_repository_init
(
&
repo
,
DISCOVER_FOLDER
,
1
));
cl_git_pass
(
git_repository_init
(
&
repo
,
DISCOVER_FOLDER
,
1
));
cl_git_pass
(
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
));
cl_git_pass
(
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
));
...
...
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