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
20ec426d
Commit
20ec426d
authored
Mar 31, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Discovered cl_git_strequal! Mounted a crusade!
parent
fd29cd13
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
87 additions
and
87 deletions
+87
-87
tests-clar/buf/basic.c
+3
-3
tests-clar/config/multivar.c
+1
-1
tests-clar/config/new.c
+2
-2
tests-clar/config/read.c
+6
-6
tests-clar/index/tests.c
+1
-1
tests-clar/network/createremotethenload.c
+2
-2
tests-clar/network/remotes.c
+14
-14
tests-clar/notes/notes.c
+2
-2
tests-clar/object/raw/compare.c
+3
-3
tests-clar/object/raw/convert.c
+2
-2
tests-clar/object/raw/type2string.c
+13
-13
tests-clar/object/tag/read.c
+2
-2
tests-clar/object/tag/write.c
+3
-3
tests-clar/object/tree/diff.c
+1
-1
tests-clar/object/tree/read.c
+1
-1
tests-clar/refs/create.c
+2
-2
tests-clar/refs/overwrite.c
+3
-3
tests-clar/refs/pack.c
+2
-2
tests-clar/refs/read.c
+6
-6
tests-clar/refs/reflog.c
+7
-7
tests-clar/refs/rename.c
+10
-10
tests-clar/repo/discover.c
+1
-1
No files found.
tests-clar/buf/basic.c
View file @
20ec426d
...
...
@@ -8,7 +8,7 @@ void test_buf_basic__resize(void)
git_buf
buf1
=
GIT_BUF_INIT
;
git_buf_puts
(
&
buf1
,
test_string
);
cl_assert
(
git_buf_oom
(
&
buf1
)
==
0
);
cl_assert
(
strcmp
(
git_buf_cstr
(
&
buf1
),
test_string
)
==
0
);
cl_assert
_strequal
(
git_buf_cstr
(
&
buf1
),
test_string
);
git_buf_puts
(
&
buf1
,
test_string
);
cl_assert
(
strlen
(
git_buf_cstr
(
&
buf1
))
==
strlen
(
test_string
)
*
2
);
...
...
@@ -20,10 +20,10 @@ void test_buf_basic__printf(void)
git_buf
buf2
=
GIT_BUF_INIT
;
git_buf_printf
(
&
buf2
,
"%s %s %d "
,
"shoop"
,
"da"
,
23
);
cl_assert
(
git_buf_oom
(
&
buf2
)
==
0
);
cl_assert
(
strcmp
(
git_buf_cstr
(
&
buf2
),
"shoop da 23 "
)
==
0
);
cl_assert
_strequal
(
git_buf_cstr
(
&
buf2
),
"shoop da 23 "
);
git_buf_printf
(
&
buf2
,
"%s %d"
,
"woop"
,
42
);
cl_assert
(
git_buf_oom
(
&
buf2
)
==
0
);
cl_assert
(
strcmp
(
git_buf_cstr
(
&
buf2
),
"shoop da 23 woop 42"
)
==
0
);
cl_assert
_strequal
(
git_buf_cstr
(
&
buf2
),
"shoop da 23 woop 42"
);
git_buf_free
(
&
buf2
);
}
tests-clar/config/multivar.c
View file @
20ec426d
...
...
@@ -21,7 +21,7 @@ static int mv_read_cb(const char *name, const char *value, void *data)
if
(
!
strcmp
(
name
,
_name
))
(
*
n
)
++
;
return
0
;
return
GIT_SUCCESS
;
}
void
test_config_multivar__foreach
(
void
)
...
...
tests-clar/config/new.c
View file @
20ec426d
...
...
@@ -26,9 +26,9 @@ void test_config_new__write_new_config(void)
cl_git_pass
(
git_config_add_file
(
config
,
file
,
0
));
cl_git_pass
(
git_config_get_string
(
config
,
"color.ui"
,
&
out
));
cl_assert
(
strcmp
(
out
,
"auto"
)
==
0
);
cl_assert
_strequal
(
out
,
"auto"
);
cl_git_pass
(
git_config_get_string
(
config
,
"core.editor"
,
&
out
));
cl_assert
(
strcmp
(
out
,
"ed"
)
==
0
);
cl_assert
_strequal
(
out
,
"ed"
);
git_config_free
(
config
);
...
...
tests-clar/config/read.c
View file @
20ec426d
...
...
@@ -28,9 +28,9 @@ void test_config_read__case_sensitive(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config1"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"this.that.other"
,
&
str
));
cl_assert
(
!
strcmp
(
str
,
"true"
)
);
cl_assert
_strequal
(
str
,
"true"
);
cl_git_pass
(
git_config_get_string
(
cfg
,
"this.That.other"
,
&
str
));
cl_assert
(
!
strcmp
(
str
,
"yes"
)
);
cl_assert
_strequal
(
str
,
"yes"
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"this.that.other"
,
&
i
));
cl_assert
(
i
==
1
);
...
...
@@ -55,7 +55,7 @@ void test_config_read__multiline_value(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config2"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"this.That.and"
,
&
str
));
cl_assert
(
!
strcmp
(
str
,
"one one one two two three three"
)
);
cl_assert
_strequal
(
str
,
"one one one two two three three"
);
git_config_free
(
cfg
);
}
...
...
@@ -71,7 +71,7 @@ void test_config_read__subsection_header(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config3"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"section.subsection.var"
,
&
str
));
cl_assert
(
!
strcmp
(
str
,
"hello"
)
);
cl_assert
_strequal
(
str
,
"hello"
);
/* The subsection is transformed to lower-case */
cl_must_fail
(
git_config_get_string
(
cfg
,
"section.subSectIon.var"
,
&
str
));
...
...
@@ -171,10 +171,10 @@ void test_config_read__prefixes(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config9"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"remote.ab.url"
,
&
str
));
cl_assert
(
strcmp
(
str
,
"http://example.com/git/ab"
)
==
0
);
cl_assert
_strequal
(
str
,
"http://example.com/git/ab"
);
cl_git_pass
(
git_config_get_string
(
cfg
,
"remote.abba.url"
,
&
str
));
cl_assert
(
strcmp
(
str
,
"http://example.com/git/abba"
)
==
0
);
cl_assert
_strequal
(
str
,
"http://example.com/git/abba"
);
git_config_free
(
cfg
);
}
...
...
tests-clar/index/tests.c
View file @
20ec426d
...
...
@@ -106,7 +106,7 @@ void test_index_tests__default_test_index(void)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
test_entries
);
++
i
)
{
git_index_entry
*
e
=
entries
[
test_entries
[
i
].
index
];
cl_assert
(
strcmp
(
e
->
path
,
test_entries
[
i
].
path
)
==
0
);
cl_assert
_strequal
(
e
->
path
,
test_entries
[
i
].
path
);
cl_assert
(
e
->
mtime
.
seconds
==
test_entries
[
i
].
mtime
);
cl_assert
(
e
->
file_size
==
test_entries
[
i
].
file_size
);
}
...
...
tests-clar/network/createremotethenload.c
View file @
20ec426d
...
...
@@ -28,6 +28,6 @@ void test_network_createremotethenload__cleanup(void)
void
test_network_createremotethenload__parsing
(
void
)
{
cl_assert
(
!
strcmp
(
git_remote_name
(
_remote
),
"origin"
)
);
cl_assert
(
!
strcmp
(
git_remote_url
(
_remote
),
url
)
);
cl_assert
_strequal
(
git_remote_name
(
_remote
),
"origin"
);
cl_assert
_strequal
(
git_remote_url
(
_remote
),
url
);
}
tests-clar/network/remotes.c
View file @
20ec426d
...
...
@@ -27,8 +27,8 @@ void test_network_remotes__cleanup(void)
void
test_network_remotes__parsing
(
void
)
{
cl_assert
(
!
strcmp
(
git_remote_name
(
_remote
),
"test"
)
);
cl_assert
(
!
strcmp
(
git_remote_url
(
_remote
),
"git://github.com/libgit2/libgit2"
)
);
cl_assert
_strequal
(
git_remote_name
(
_remote
),
"test"
);
cl_assert
_strequal
(
git_remote_url
(
_remote
),
"git://github.com/libgit2/libgit2"
);
}
void
test_network_remotes__parsing_ssh_remote
(
void
)
...
...
@@ -53,24 +53,24 @@ void test_network_remotes__unsupported_transport_methods_are_unsupported(void)
void
test_network_remotes__refspec_parsing
(
void
)
{
cl_assert
(
!
strcmp
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
)
);
cl_assert
(
!
strcmp
(
git_refspec_dst
(
_refspec
),
"refs/remotes/test/*"
)
);
cl_assert
_strequal
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
);
cl_assert
_strequal
(
git_refspec_dst
(
_refspec
),
"refs/remotes/test/*"
);
}
void
test_network_remotes__set_fetchspec
(
void
)
{
cl_git_pass
(
git_remote_set_fetchspec
(
_remote
,
"refs/*:refs/*"
));
_refspec
=
git_remote_fetchspec
(
_remote
);
cl_assert
(
!
strcmp
(
git_refspec_src
(
_refspec
),
"refs/*"
)
);
cl_assert
(
!
strcmp
(
git_refspec_dst
(
_refspec
),
"refs/*"
)
);
cl_assert
_strequal
(
git_refspec_src
(
_refspec
),
"refs/*"
);
cl_assert
_strequal
(
git_refspec_dst
(
_refspec
),
"refs/*"
);
}
void
test_network_remotes__set_pushspec
(
void
)
{
cl_git_pass
(
git_remote_set_pushspec
(
_remote
,
"refs/*:refs/*"
));
_refspec
=
git_remote_pushspec
(
_remote
);
cl_assert
(
!
strcmp
(
git_refspec_src
(
_refspec
),
"refs/*"
)
);
cl_assert
(
!
strcmp
(
git_refspec_dst
(
_refspec
),
"refs/*"
)
);
cl_assert
_strequal
(
git_refspec_src
(
_refspec
),
"refs/*"
);
cl_assert
_strequal
(
git_refspec_dst
(
_refspec
),
"refs/*"
);
}
void
test_network_remotes__save
(
void
)
...
...
@@ -90,13 +90,13 @@ void test_network_remotes__save(void)
_refspec
=
git_remote_fetchspec
(
_remote
);
cl_assert
(
_refspec
!=
NULL
);
cl_assert
(
!
strcmp
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
)
);
cl_assert
(
!
strcmp
(
git_refspec_dst
(
_refspec
),
"refs/remotes/upstream/*"
)
);
cl_assert
_strequal
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
);
cl_assert
_strequal
(
git_refspec_dst
(
_refspec
),
"refs/remotes/upstream/*"
);
_refspec
=
git_remote_pushspec
(
_remote
);
cl_assert
(
_refspec
!=
NULL
);
cl_assert
(
!
strcmp
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
)
);
cl_assert
(
!
strcmp
(
git_refspec_dst
(
_refspec
),
"refs/heads/*"
)
);
cl_assert
_strequal
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
);
cl_assert
_strequal
(
git_refspec_dst
(
_refspec
),
"refs/heads/*"
);
}
void
test_network_remotes__fnmatch
(
void
)
...
...
@@ -111,7 +111,7 @@ void test_network_remotes__transform(void)
memset
(
ref
,
0x0
,
sizeof
(
ref
));
cl_git_pass
(
git_refspec_transform
(
ref
,
sizeof
(
ref
),
_refspec
,
"refs/heads/master"
));
cl_assert
(
!
strcmp
(
ref
,
"refs/remotes/test/master"
)
);
cl_assert
_strequal
(
ref
,
"refs/remotes/test/master"
);
}
void
test_network_remotes__transform_r
(
void
)
...
...
@@ -119,7 +119,7 @@ void test_network_remotes__transform_r(void)
git_buf
buf
=
GIT_BUF_INIT
;
cl_git_pass
(
git_refspec_transform_r
(
&
buf
,
_refspec
,
"refs/heads/master"
));
cl_assert
(
!
strcmp
(
git_buf_cstr
(
&
buf
),
"refs/remotes/test/master"
)
);
cl_assert
_strequal
(
git_buf_cstr
(
&
buf
),
"refs/remotes/test/master"
);
git_buf_free
(
&
buf
);
}
...
...
tests-clar/notes/notes.c
View file @
20ec426d
...
...
@@ -33,11 +33,11 @@ void test_notes_notes__1(void)
cl_git_pass
(
git_note_read
(
&
_note
,
_repo
,
NULL
,
&
oid
));
cl_assert
(
!
strcmp
(
git_note_message
(
_note
),
"hello world
\n
"
)
);
cl_assert
_strequal
(
git_note_message
(
_note
),
"hello world
\n
"
);
cl_assert
(
!
git_oid_cmp
(
git_note_oid
(
_note
),
&
note_oid
));
cl_git_pass
(
git_blob_lookup
(
&
_blob
,
_repo
,
&
note_oid
));
cl_assert
(
!
strcmp
(
git_note_message
(
_note
),
git_blob_rawcontent
(
_blob
)
));
cl_assert
_strequal
(
git_note_message
(
_note
),
git_blob_rawcontent
(
_blob
));
cl_git_fail
(
git_note_create
(
&
note_oid
,
_repo
,
_sig
,
_sig
,
NULL
,
&
oid
,
"hello world
\n
"
));
cl_git_fail
(
git_note_create
(
&
note_oid
,
_repo
,
_sig
,
_sig
,
"refs/notes/some/namespace"
,
&
oid
,
"hello world
\n
"
));
...
...
tests-clar/object/raw/compare.c
View file @
20ec426d
...
...
@@ -87,7 +87,7 @@ void test_object_raw_compare__compare_fmt_oids(void)
/* Format produced the right result */
out
[
GIT_OID_HEXSZ
]
=
'\0'
;
cl_assert
(
strcmp
(
exp
,
out
)
==
0
);
cl_assert
_strequal
(
exp
,
out
);
}
void
test_object_raw_compare__compare_allocfmt_oids
(
void
)
...
...
@@ -100,7 +100,7 @@ void test_object_raw_compare__compare_allocfmt_oids(void)
out
=
git_oid_allocfmt
(
&
in
);
cl_assert
(
out
);
cl_assert
(
strcmp
(
exp
,
out
)
==
0
);
cl_assert
_strequal
(
exp
,
out
);
git__free
(
out
);
}
...
...
@@ -120,5 +120,5 @@ void test_object_raw_compare__compare_pathfmt_oids(void)
/* Format produced the right result */
out
[
GIT_OID_HEXSZ
+
1
]
=
'\0'
;
cl_assert
(
strcmp
(
exp2
,
out
)
==
0
);
cl_assert
_strequal
(
exp2
,
out
);
}
tests-clar/object/raw/convert.c
View file @
20ec426d
...
...
@@ -45,7 +45,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
/* returns out as hex formatted c-string */
str
=
git_oid_tostr
(
out
,
sizeof
(
out
),
&
in
);
cl_assert
(
str
&&
str
==
out
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
cl_assert
(
strcmp
(
exp
,
out
)
==
0
);
cl_assert
_strequal
(
exp
,
out
);
}
void
test_object_raw_convert__succeed_on_oid_to_string_conversion_big
(
void
)
...
...
@@ -66,7 +66,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
/* returns big as hex formatted c-string */
str
=
git_oid_tostr
(
big
,
sizeof
(
big
),
&
in
);
cl_assert
(
str
&&
str
==
big
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
cl_assert
(
strcmp
(
exp
,
big
)
==
0
);
cl_assert
_strequal
(
exp
,
big
);
/* check tail material is untouched */
cl_assert
(
str
&&
str
==
big
&&
*
(
str
+
GIT_OID_HEXSZ
+
1
)
==
'X'
);
...
...
tests-clar/object/raw/type2string.c
View file @
20ec426d
...
...
@@ -6,19 +6,19 @@
void
test_object_raw_type2string__convert_type_to_string
(
void
)
{
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ_BAD
),
""
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ__EXT1
),
""
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ_COMMIT
),
"commit"
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ_TREE
),
"tree"
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ_BLOB
),
"blob"
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ_TAG
),
"tag"
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ__EXT2
),
""
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ_OFS_DELTA
),
"OFS_DELTA"
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
GIT_OBJ_REF_DELTA
),
"REF_DELTA"
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
-
2
),
""
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
8
),
""
)
);
cl_assert
(
!
strcmp
(
git_object_type2string
(
1234
),
""
)
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ_BAD
),
""
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ__EXT1
),
""
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ_COMMIT
),
"commit"
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ_TREE
),
"tree"
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ_BLOB
),
"blob"
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ_TAG
),
"tag"
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ__EXT2
),
""
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ_OFS_DELTA
),
"OFS_DELTA"
);
cl_assert
_strequal
(
git_object_type2string
(
GIT_OBJ_REF_DELTA
),
"REF_DELTA"
);
cl_assert
_strequal
(
git_object_type2string
(
-
2
),
""
);
cl_assert
_strequal
(
git_object_type2string
(
8
),
""
);
cl_assert
_strequal
(
git_object_type2string
(
1234
),
""
);
}
void
test_object_raw_type2string__convert_string_to_type
(
void
)
...
...
tests-clar/object/tag/read.c
View file @
20ec426d
...
...
@@ -54,7 +54,7 @@ void test_object_tag_read__parse(void)
cl_git_pass
(
git_tag_lookup
(
&
tag1
,
g_repo
,
&
id1
));
cl_assert
(
strcmp
(
git_tag_name
(
tag1
),
"test"
)
==
0
);
cl_assert
_strequal
(
git_tag_name
(
tag1
),
"test"
);
cl_assert
(
git_tag_type
(
tag1
)
==
GIT_OBJ_TAG
);
cl_git_pass
(
git_tag_target
((
git_object
**
)
&
tag2
,
tag1
));
...
...
@@ -113,7 +113,7 @@ void test_object_tag_read__parse_without_tagger(void)
cl_git_pass
(
git_tag_lookup
(
&
bad_tag
,
bad_tag_repo
,
&
id
));
cl_assert
(
bad_tag
!=
NULL
);
cl_assert
(
strcmp
(
git_tag_name
(
bad_tag
),
"e90810b"
)
==
0
);
cl_assert
_strequal
(
git_tag_name
(
bad_tag
),
"e90810b"
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_tag_id
(
bad_tag
))
==
0
);
cl_assert
(
bad_tag
->
tagger
==
NULL
);
...
...
tests-clar/object/tag/write.c
View file @
20ec426d
...
...
@@ -103,12 +103,12 @@ void test_object_tag_write__basic(void)
/* Check attributes were set correctly */
tagger1
=
git_tag_tagger
(
tag
);
cl_assert
(
tagger1
!=
NULL
);
cl_assert
(
strcmp
(
tagger1
->
name
,
tagger_name
)
==
0
);
cl_assert
(
strcmp
(
tagger1
->
email
,
tagger_email
)
==
0
);
cl_assert
_strequal
(
tagger1
->
name
,
tagger_name
);
cl_assert
_strequal
(
tagger1
->
email
,
tagger_email
);
cl_assert
(
tagger1
->
when
.
time
==
123456789
);
cl_assert
(
tagger1
->
when
.
offset
==
60
);
cl_assert
(
strcmp
(
git_tag_message
(
tag
),
tagger_message
)
==
0
);
cl_assert
_strequal
(
git_tag_message
(
tag
),
tagger_message
);
cl_git_pass
(
git_reference_lookup
(
&
ref_tag
,
g_repo
,
"refs/tags/the-tag"
));
cl_assert
(
git_oid_cmp
(
git_reference_oid
(
ref_tag
),
&
tag_id
)
==
0
);
...
...
tests-clar/object/tree/diff.c
View file @
20ec426d
...
...
@@ -18,7 +18,7 @@ static void diff_cmp(const git_tree_diff_data *a, const git_tree_diff_data *b)
cl_assert
(
a
->
status
-
b
->
status
==
0
);
cl_assert
(
strcmp
(
a
->
path
,
b
->
path
)
==
0
);
cl_assert
_strequal
(
a
->
path
,
b
->
path
);
}
static
int
diff_cb
(
const
git_tree_diff_data
*
diff
,
void
*
data
)
...
...
tests-clar/object/tree/read.c
View file @
20ec426d
...
...
@@ -65,7 +65,7 @@ void test_object_tree_read__two(void)
entry
=
git_tree_entry_byname
(
tree
,
"README"
);
cl_assert
(
entry
!=
NULL
);
cl_assert
(
strcmp
(
git_tree_entry_name
(
entry
),
"README"
)
==
0
);
cl_assert
_strequal
(
git_tree_entry_name
(
entry
),
"README"
);
cl_git_pass
(
git_tree_entry_2object
(
&
obj
,
g_repo
,
entry
));
cl_assert
(
obj
!=
NULL
);
...
...
tests-clar/refs/create.c
View file @
20ec426d
...
...
@@ -46,7 +46,7 @@ void test_ref_create__symbolic(void)
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head_tracker
));
cl_assert
(
git_reference_type
(
looked_up_ref
)
&
GIT_REF_SYMBOLIC
);
cl_assert
(
git_reference_is_packed
(
looked_up_ref
)
==
0
);
cl_assert
(
strcmp
(
looked_up_ref
->
name
,
new_head_tracker
)
==
0
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
new_head_tracker
);
/* ...peeled.. */
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
looked_up_ref
));
...
...
@@ -116,7 +116,7 @@ void test_ref_create__oid(void)
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head
));
cl_assert
(
git_reference_type
(
looked_up_ref
)
&
GIT_REF_OID
);
cl_assert
(
git_reference_is_packed
(
looked_up_ref
)
==
0
);
cl_assert
(
strcmp
(
looked_up_ref
->
name
,
new_head
)
==
0
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
new_head
);
/* ...and that it points to the current master tip */
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_oid
(
looked_up_ref
))
==
0
);
...
...
tests-clar/refs/overwrite.c
View file @
20ec426d
...
...
@@ -38,7 +38,7 @@ void test_ref_overwrite__symbolic(void)
/* Ensure it points to the right place*/
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_name
));
cl_assert
(
git_reference_type
(
ref
)
&
GIT_REF_SYMBOLIC
);
cl_assert
(
!
strcmp
(
git_reference_target
(
ref
),
ref_branch_name
)
);
cl_assert
_strequal
(
git_reference_target
(
ref
),
ref_branch_name
);
git_reference_free
(
ref
);
/* Ensure we can't create it unless we force it to */
...
...
@@ -49,7 +49,7 @@ void test_ref_overwrite__symbolic(void)
/* Ensure it points to the right place */
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_name
));
cl_assert
(
git_reference_type
(
ref
)
&
GIT_REF_SYMBOLIC
);
cl_assert
(
!
strcmp
(
git_reference_target
(
ref
),
ref_master_name
)
);
cl_assert
_strequal
(
git_reference_target
(
ref
),
ref_master_name
);
git_reference_free
(
ref
);
git_reference_free
(
branch_ref
);
...
...
@@ -107,7 +107,7 @@ void test_ref_overwrite__object_id_with_symbolic(void)
/* Ensure it points to the right place */
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_name
));
cl_assert
(
git_reference_type
(
ref
)
&
GIT_REF_SYMBOLIC
);
cl_assert
(
!
strcmp
(
git_reference_target
(
ref
),
ref_master_name
)
);
cl_assert
_strequal
(
git_reference_target
(
ref
),
ref_master_name
);
git_reference_free
(
ref
);
}
...
...
tests-clar/refs/pack.c
View file @
20ec426d
...
...
@@ -43,7 +43,7 @@ void test_ref_pack__loose(void)
/* Ensure a known loose ref can be looked up */
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
loose_tag_ref_name
));
cl_assert
(
git_reference_is_packed
(
reference
)
==
0
);
cl_assert
(
strcmp
(
reference
->
name
,
loose_tag_ref_name
)
==
0
);
cl_assert
_strequal
(
reference
->
name
,
loose_tag_ref_name
);
git_reference_free
(
reference
);
/*
...
...
@@ -60,7 +60,7 @@ void test_ref_pack__loose(void)
/* 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_assert
(
git_reference_is_packed
(
reference
));
cl_assert
(
strcmp
(
reference
->
name
,
loose_tag_ref_name
)
==
0
);
cl_assert
_strequal
(
reference
->
name
,
loose_tag_ref_name
);
/* 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
));
...
...
tests-clar/refs/read.c
View file @
20ec426d
...
...
@@ -39,7 +39,7 @@ void test_ref_read__loose_tag(void)
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
loose_tag_ref_name
));
cl_assert
(
git_reference_type
(
reference
)
&
GIT_REF_OID
);
cl_assert
(
git_reference_is_packed
(
reference
)
==
0
);
cl_assert
(
strcmp
(
reference
->
name
,
loose_tag_ref_name
)
==
0
);
cl_assert
_strequal
(
reference
->
name
,
loose_tag_ref_name
);
cl_git_pass
(
git_object_lookup
(
&
object
,
g_repo
,
git_reference_oid
(
reference
),
GIT_OBJ_ANY
));
cl_assert
(
object
!=
NULL
);
...
...
@@ -47,7 +47,7 @@ void test_ref_read__loose_tag(void)
/* Ensure the name of the tag matches the name of the reference */
cl_git_pass
(
git_buf_joinpath
(
&
ref_name_from_tag_name
,
GIT_REFS_TAGS_DIR
,
git_tag_name
((
git_tag
*
)
object
)));
cl_assert
(
strcmp
(
ref_name_from_tag_name
.
ptr
,
loose_tag_ref_name
)
==
0
);
cl_assert
_strequal
(
ref_name_from_tag_name
.
ptr
,
loose_tag_ref_name
);
git_buf_free
(
&
ref_name_from_tag_name
);
git_object_free
(
object
);
...
...
@@ -76,7 +76,7 @@ void test_ref_read__symbolic(void)
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
GIT_HEAD_FILE
));
cl_assert
(
git_reference_type
(
reference
)
&
GIT_REF_SYMBOLIC
);
cl_assert
(
git_reference_is_packed
(
reference
)
==
0
);
cl_assert
(
strcmp
(
reference
->
name
,
GIT_HEAD_FILE
)
==
0
);
cl_assert
_strequal
(
reference
->
name
,
GIT_HEAD_FILE
);
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_assert
(
git_reference_type
(
resolved_ref
)
==
GIT_REF_OID
);
...
...
@@ -104,7 +104,7 @@ void test_ref_read__nested_symbolic(void)
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
head_tracker_sym_ref_name
));
cl_assert
(
git_reference_type
(
reference
)
&
GIT_REF_SYMBOLIC
);
cl_assert
(
git_reference_is_packed
(
reference
)
==
0
);
cl_assert
(
strcmp
(
reference
->
name
,
head_tracker_sym_ref_name
)
==
0
);
cl_assert
_strequal
(
reference
->
name
,
head_tracker_sym_ref_name
);
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_assert
(
git_reference_type
(
resolved_ref
)
==
GIT_REF_OID
);
...
...
@@ -172,7 +172,7 @@ void test_ref_read__packed(void)
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
packed_head_name
));
cl_assert
(
git_reference_type
(
reference
)
&
GIT_REF_OID
);
cl_assert
(
git_reference_is_packed
(
reference
));
cl_assert
(
strcmp
(
reference
->
name
,
packed_head_name
)
==
0
);
cl_assert
_strequal
(
reference
->
name
,
packed_head_name
);
cl_git_pass
(
git_object_lookup
(
&
object
,
g_repo
,
git_reference_oid
(
reference
),
GIT_OBJ_ANY
));
cl_assert
(
object
!=
NULL
);
...
...
@@ -193,7 +193,7 @@ void test_ref_read__loose_first(void)
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
packed_test_head_name
));
cl_assert
(
git_reference_type
(
reference
)
&
GIT_REF_OID
);
cl_assert
(
git_reference_is_packed
(
reference
)
==
0
);
cl_assert
(
strcmp
(
reference
->
name
,
packed_test_head_name
)
==
0
);
cl_assert
_strequal
(
reference
->
name
,
packed_test_head_name
);
git_reference_free
(
reference
);
}
tests-clar/refs/reflog.c
View file @
20ec426d
...
...
@@ -16,8 +16,8 @@ static git_repository *g_repo;
static
void
assert_signature
(
git_signature
*
expected
,
git_signature
*
actual
)
{
cl_assert
(
actual
);
cl_assert
(
0
==
strcmp
(
expected
->
name
,
actual
->
name
)
);
cl_assert
(
0
==
strcmp
(
expected
->
email
,
actual
->
email
)
);
cl_assert
_strequal
(
expected
->
name
,
actual
->
name
);
cl_assert
_strequal
(
expected
->
email
,
actual
->
email
);
cl_assert
(
expected
->
when
.
offset
==
actual
->
when
.
offset
);
cl_assert
(
expected
->
when
.
time
==
actual
->
when
.
time
);
}
...
...
@@ -73,18 +73,18 @@ void test_refs_reflog__write_then_read(void)
entry
=
(
git_reflog_entry
*
)
git_vector_get
(
&
reflog
->
entries
,
0
);
assert_signature
(
committer
,
entry
->
committer
);
git_oid_tostr
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_old
);
cl_assert
(
strcmp
(
"0000000000000000000000000000000000000000"
,
oid_str
)
==
0
);
cl_assert
_strequal
(
"0000000000000000000000000000000000000000"
,
oid_str
);
git_oid_tostr
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_cur
);
cl_assert
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
cl_assert
_strequal
(
current_master_tip
,
oid_str
);
cl_assert
(
entry
->
msg
==
NULL
);
entry
=
(
git_reflog_entry
*
)
git_vector_get
(
&
reflog
->
entries
,
1
);
assert_signature
(
committer
,
entry
->
committer
);
git_oid_tostr
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_old
);
cl_assert
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
cl_assert
_strequal
(
current_master_tip
,
oid_str
);
git_oid_tostr
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_cur
);
cl_assert
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
cl_assert
(
strcmp
(
commit_msg
,
entry
->
msg
)
==
0
);
cl_assert
_strequal
(
current_master_tip
,
oid_str
);
cl_assert
_strequal
(
commit_msg
,
entry
->
msg
);
git_signature_free
(
committer
);
git_reflog_free
(
reflog
);
...
...
tests-clar/refs/rename.c
View file @
20ec426d
...
...
@@ -48,14 +48,14 @@ void test_refs_rename__loose(void)
/* Now that the reference is renamed... */
cl_git_pass
(
git_reference_rename
(
looked_up_ref
,
new_name
,
0
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
new_name
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
new_name
);
/* ...It can't be looked-up with the old name... */
cl_git_fail
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
loose_tag_ref_name
));
/* ...but the new name works ok... */
cl_git_pass
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
new_name
));
cl_assert
(
!
strcmp
(
another_looked_up_ref
->
name
,
new_name
)
);
cl_assert
_strequal
(
another_looked_up_ref
->
name
,
new_name
);
/* .. the ref is still loose... */
cl_assert
(
git_reference_is_packed
(
another_looked_up_ref
)
==
0
);
...
...
@@ -89,14 +89,14 @@ void test_refs_rename__packed(void)
/* Now that the reference is renamed... */
cl_git_pass
(
git_reference_rename
(
looked_up_ref
,
brand_new_name
,
0
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
brand_new_name
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
brand_new_name
);
/* ...It can't be looked-up with the old name... */
cl_git_fail
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
packed_head_name
));
/* ...but the new name works ok... */
cl_git_pass
(
git_reference_lookup
(
&
another_looked_up_ref
,
g_repo
,
brand_new_name
));
cl_assert
(
!
strcmp
(
another_looked_up_ref
->
name
,
brand_new_name
)
);
cl_assert
_strequal
(
another_looked_up_ref
->
name
,
brand_new_name
);
/* .. the ref is no longer packed... */
cl_assert
(
git_reference_is_packed
(
another_looked_up_ref
)
==
0
);
...
...
@@ -166,7 +166,7 @@ void test_refs_rename__name_collision(void)
/* Failure to rename it hasn't corrupted its state */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
packed_head_name
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
packed_head_name
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
packed_head_name
);
git_reference_free
(
looked_up_ref
);
}
...
...
@@ -188,7 +188,7 @@ void test_refs_rename__invalid_name(void)
/* Failure to rename it hasn't corrupted its state */
git_reference_free
(
looked_up_ref
);
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
packed_test_head_name
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
packed_test_head_name
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
packed_test_head_name
);
git_reference_free
(
looked_up_ref
);
}
...
...
@@ -209,7 +209,7 @@ void test_refs_rename__force_loose_packed(void)
/* Check we actually renamed it */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
packed_test_head_name
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
packed_test_head_name
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
packed_test_head_name
);
cl_assert
(
!
git_oid_cmp
(
&
oid
,
git_reference_oid
(
looked_up_ref
)));
git_reference_free
(
looked_up_ref
);
...
...
@@ -233,7 +233,7 @@ void test_refs_rename__force_loose(void)
/* Check we actually renamed it */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
"refs/heads/test"
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
"refs/heads/test"
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
"refs/heads/test"
);
cl_assert
(
!
git_oid_cmp
(
&
oid
,
git_reference_oid
(
looked_up_ref
)));
git_reference_free
(
looked_up_ref
);
...
...
@@ -298,7 +298,7 @@ void test_refs_rename__prefix(void)
/* Check we actually renamed it */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
ref_two_name_new
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
ref_two_name_new
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
ref_two_name_new
);
git_reference_free
(
looked_up_ref
);
cl_git_fail
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
ref_two_name
));
...
...
@@ -331,7 +331,7 @@ void test_refs_rename__move_up(void)
/* Check we actually renamed it */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
ref_two_name
));
cl_assert
(
!
strcmp
(
looked_up_ref
->
name
,
ref_two_name
)
);
cl_assert
_strequal
(
looked_up_ref
->
name
,
ref_two_name
);
git_reference_free
(
looked_up_ref
);
cl_git_fail
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
ref_two_name_new
));
git_reference_free
(
ref
);
...
...
tests-clar/repo/discover.c
View file @
20ec426d
...
...
@@ -28,7 +28,7 @@ static void ensure_repository_discover(const char *start_path, const char *ceili
char
found_path
[
GIT_PATH_MAX
];
cl_git_pass
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
start_path
,
0
,
ceiling_dirs
));
//across_fs is always 0 as we can't automate the filesystem change tests
cl_assert
(
0
==
strcmp
(
found_path
,
expected_path
)
);
cl_assert
_strequal
(
found_path
,
expected_path
);
}
static
void
write_file
(
const
char
*
path
,
const
char
*
content
)
...
...
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