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
c1bf2942
Commit
c1bf2942
authored
Jul 02, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2455 from ethomson/equal_oid
Introduce `cl_assert_equal_oid`
parents
4df4ebd7
9879fee1
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
161 additions
and
151 deletions
+161
-151
tests/blame/blame_helpers.c
+1
-1
tests/checkout/binaryunicode.c
+2
-2
tests/checkout/conflict.c
+1
-1
tests/clar_libgit2.h
+18
-0
tests/clone/nonetwork.c
+1
-1
tests/commit/commit.c
+1
-1
tests/commit/write.c
+1
-1
tests/diff/blob.c
+6
-6
tests/diff/iterator.c
+1
-1
tests/fetchhead/nonetwork.c
+4
-4
tests/index/conflicts.c
+13
-13
tests/index/crlf.c
+6
-6
tests/index/read_tree.c
+1
-1
tests/index/rename.c
+2
-2
tests/index/reuc.c
+27
-27
tests/index/tests.c
+4
-4
tests/merge/trees/trivial.c
+1
-1
tests/notes/notes.c
+4
-4
tests/notes/notesref.c
+2
-2
tests/object/lookupbypath.c
+6
-6
tests/object/peel.c
+1
-1
tests/odb/mixed.c
+3
-3
tests/pack/indexer.c
+2
-2
tests/refs/create.c
+5
-5
tests/refs/createwithlog.c
+1
-1
tests/refs/lookup.c
+1
-1
tests/refs/overwrite.c
+2
-2
tests/refs/peel.c
+1
-1
tests/refs/read.c
+7
-7
tests/refs/rename.c
+2
-2
tests/refs/settargetwithlog.c
+2
-2
tests/refs/setter.c
+1
-1
tests/refs/unicode.c
+2
-4
tests/repo/hashfile.c
+6
-6
tests/repo/head.c
+2
-2
tests/revwalk/hidecb.c
+5
-11
tests/revwalk/mergebase.c
+7
-7
tests/revwalk/simplify.c
+3
-3
tests/stash/drop.c
+4
-4
tests/status/single.c
+2
-2
No files found.
tests/blame/blame_helpers.c
View file @
c1bf2942
...
@@ -48,7 +48,7 @@ void check_blame_hunk_index(git_repository *repo, git_blame *blame, int idx,
...
@@ -48,7 +48,7 @@ void check_blame_hunk_index(git_repository *repo, git_blame *blame, int idx,
actual
,
expected
);
actual
,
expected
);
}
}
cl_assert_equal_s
(
actual
,
expected
);
cl_assert_equal_s
(
actual
,
expected
);
cl_assert_equal_
i
(
git_oid_cmp
(
&
hunk
->
final_commit_id
,
&
hunk
->
orig_commit_id
),
0
);
cl_assert_equal_
oid
(
&
hunk
->
final_commit_id
,
&
hunk
->
orig_commit_id
);
if
(
strcmp
(
hunk
->
orig_path
,
orig_path
))
{
if
(
strcmp
(
hunk
->
orig_path
,
orig_path
))
{
...
...
tests/checkout/binaryunicode.c
View file @
c1bf2942
...
@@ -37,12 +37,12 @@ static void execute_test(void)
...
@@ -37,12 +37,12 @@ static void execute_test(void)
/* Verify that the lenna.jpg file was checked out correctly */
/* Verify that the lenna.jpg file was checked out correctly */
cl_git_pass
(
git_oid_fromstr
(
&
check
,
"8ab005d890fe53f65eda14b23672f60d9f4ec5a1"
));
cl_git_pass
(
git_oid_fromstr
(
&
check
,
"8ab005d890fe53f65eda14b23672f60d9f4ec5a1"
));
cl_git_pass
(
git_odb_hashfile
(
&
oid
,
"binaryunicode/lenna.jpg"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
oid
,
"binaryunicode/lenna.jpg"
,
GIT_OBJ_BLOB
));
cl_assert
(
git_oid_equal
(
&
oid
,
&
check
)
);
cl_assert
_equal_oid
(
&
oid
,
&
check
);
/* Verify that the text file was checked out correctly */
/* Verify that the text file was checked out correctly */
cl_git_pass
(
git_oid_fromstr
(
&
check
,
"965b223880dd4249e2c66a0cc0b4cffe1dc40f5a"
));
cl_git_pass
(
git_oid_fromstr
(
&
check
,
"965b223880dd4249e2c66a0cc0b4cffe1dc40f5a"
));
cl_git_pass
(
git_odb_hashfile
(
&
oid
,
"binaryunicode/utf16_withbom_noeol_crlf.txt"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
oid
,
"binaryunicode/utf16_withbom_noeol_crlf.txt"
,
GIT_OBJ_BLOB
));
cl_assert
(
git_oid_equal
(
&
oid
,
&
check
)
);
cl_assert
_equal_oid
(
&
oid
,
&
check
);
}
}
void
test_checkout_binaryunicode__noautocrlf
(
void
)
void
test_checkout_binaryunicode__noautocrlf
(
void
)
...
...
tests/checkout/conflict.c
View file @
c1bf2942
...
@@ -156,7 +156,7 @@ static void ensure_workdir_oid(const char *path, const char *oid_str)
...
@@ -156,7 +156,7 @@ static void ensure_workdir_oid(const char *path, const char *oid_str)
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
oid_str
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
oid_str
));
cl_git_pass
(
git_repository_hashfile
(
&
actual
,
g_repo
,
path
,
GIT_OBJ_BLOB
,
NULL
));
cl_git_pass
(
git_repository_hashfile
(
&
actual
,
g_repo
,
path
,
GIT_OBJ_BLOB
,
NULL
));
cl_assert
(
git_oid_cmp
(
&
expected
,
&
actual
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
actual
);
}
}
static
void
ensure_workdir_mode
(
const
char
*
path
,
int
mode
)
static
void
ensure_workdir_mode
(
const
char
*
path
,
int
mode
)
...
...
tests/clar_libgit2.h
View file @
c1bf2942
...
@@ -78,6 +78,24 @@ void clar__assert_equal_file(
...
@@ -78,6 +78,24 @@ void clar__assert_equal_file(
const
char
*
file
,
const
char
*
file
,
int
line
);
int
line
);
GIT_INLINE
(
void
)
clar__assert_equal_oid
(
const
char
*
file
,
int
line
,
const
char
*
desc
,
const
git_oid
*
one
,
const
git_oid
*
two
)
{
if
(
git_oid_cmp
(
one
,
two
))
{
char
err
[]
=
"
\"
........................................
\"
!=
\"
........................................
\"
"
;
git_oid_fmt
(
&
err
[
1
],
one
);
git_oid_fmt
(
&
err
[
47
],
two
);
clar__fail
(
file
,
line
,
desc
,
err
,
1
);
}
}
#define cl_assert_equal_oid(one, two) \
clar__assert_equal_oid(__FILE__, __LINE__, \
"OID mismatch: " #one " != " #two, (one), (two))
/*
/*
* Some utility macros for building long strings
* Some utility macros for building long strings
*/
*/
...
...
tests/clone/nonetwork.c
View file @
c1bf2942
...
@@ -241,7 +241,7 @@ void test_clone_nonetwork__can_detached_head(void)
...
@@ -241,7 +241,7 @@ void test_clone_nonetwork__can_detached_head(void)
cl_assert
(
git_repository_head_detached
(
cloned
));
cl_assert
(
git_repository_head_detached
(
cloned
));
cl_git_pass
(
git_repository_head
(
&
cloned_head
,
cloned
));
cl_git_pass
(
git_repository_head
(
&
cloned_head
,
cloned
));
cl_assert
(
!
git_oid_cmp
(
git_object_id
(
obj
),
git_reference_target
(
cloned_head
)
));
cl_assert
_equal_oid
(
git_object_id
(
obj
),
git_reference_target
(
cloned_head
));
cl_git_pass
(
git_reflog_read
(
&
log
,
cloned
,
"HEAD"
));
cl_git_pass
(
git_reflog_read
(
&
log
,
cloned
,
"HEAD"
));
entry
=
git_reflog_entry_byindex
(
log
,
0
);
entry
=
git_reflog_entry_byindex
(
log
,
0
);
...
...
tests/commit/commit.c
View file @
c1bf2942
...
@@ -43,7 +43,7 @@ void test_commit_commit__create_unexisting_update_ref(void)
...
@@ -43,7 +43,7 @@ void test_commit_commit__create_unexisting_update_ref(void)
NULL
,
"some msg"
,
tree
,
1
,
(
const
git_commit
**
)
&
commit
));
NULL
,
"some msg"
,
tree
,
1
,
(
const
git_commit
**
)
&
commit
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
_repo
,
"refs/heads/foo/bar"
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
_repo
,
"refs/heads/foo/bar"
));
cl_assert
(
!
git_oid_cmp
(
&
oid
,
git_reference_target
(
ref
)
));
cl_assert
_equal_oid
(
&
oid
,
git_reference_target
(
ref
));
git_tree_free
(
tree
);
git_tree_free
(
tree
);
git_commit_free
(
commit
);
git_commit_free
(
commit
);
...
...
tests/commit/write.c
View file @
c1bf2942
...
@@ -145,7 +145,7 @@ void test_commit_write__root(void)
...
@@ -145,7 +145,7 @@ void test_commit_write__root(void)
cl_assert
(
git_commit_parentcount
(
commit
)
==
0
);
cl_assert
(
git_commit_parentcount
(
commit
)
==
0
);
cl_git_pass
(
git_reference_lookup
(
&
branch
,
g_repo
,
branch_name
));
cl_git_pass
(
git_reference_lookup
(
&
branch
,
g_repo
,
branch_name
));
branch_oid
=
git_reference_target
(
branch
);
branch_oid
=
git_reference_target
(
branch
);
cl_
git_pass
(
git_oid_cmp
(
branch_oid
,
&
commit_id
)
);
cl_
assert_equal_oid
(
branch_oid
,
&
commit_id
);
cl_assert_equal_s
(
root_commit_message
,
git_commit_message
(
commit
));
cl_assert_equal_s
(
root_commit_message
,
git_commit_message
(
commit
));
cl_git_pass
(
git_reflog_read
(
&
log
,
g_repo
,
branch_name
));
cl_git_pass
(
git_reflog_read
(
&
log
,
g_repo
,
branch_name
));
...
...
tests/diff/blob.c
View file @
c1bf2942
...
@@ -137,9 +137,9 @@ static void assert_patch_matches_blobs(
...
@@ -137,9 +137,9 @@ static void assert_patch_matches_blobs(
cl_assert
(
delta
!=
NULL
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
delta
->
status
);
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
delta
->
status
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
a
),
&
delta
->
old_file
.
id
)
);
cl_assert
_equal_oid
(
git_blob_id
(
a
),
&
delta
->
old_file
.
id
);
cl_assert_equal_sz
(
git_blob_rawsize
(
a
),
delta
->
old_file
.
size
);
cl_assert_equal_sz
(
git_blob_rawsize
(
a
),
delta
->
old_file
.
size
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
b
),
&
delta
->
new_file
.
id
)
);
cl_assert
_equal_oid
(
git_blob_id
(
b
),
&
delta
->
new_file
.
id
);
cl_assert_equal_sz
(
git_blob_rawsize
(
b
),
delta
->
new_file
.
size
);
cl_assert_equal_sz
(
git_blob_rawsize
(
b
),
delta
->
new_file
.
size
);
cl_assert_equal_i
(
hunks
,
(
int
)
git_patch_num_hunks
(
p
));
cl_assert_equal_i
(
hunks
,
(
int
)
git_patch_num_hunks
(
p
));
...
@@ -274,7 +274,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
...
@@ -274,7 +274,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
delta
=
git_patch_get_delta
(
p
);
delta
=
git_patch_get_delta
(
p
);
cl_assert
(
delta
!=
NULL
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_DELETED
,
delta
->
status
);
cl_assert_equal_i
(
GIT_DELTA_DELETED
,
delta
->
status
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
old_file
.
id
)
);
cl_assert
_equal_oid
(
git_blob_id
(
d
),
&
delta
->
old_file
.
id
);
cl_assert_equal_sz
(
git_blob_rawsize
(
d
),
delta
->
old_file
.
size
);
cl_assert_equal_sz
(
git_blob_rawsize
(
d
),
delta
->
old_file
.
size
);
cl_assert
(
git_oid_iszero
(
&
delta
->
new_file
.
id
));
cl_assert
(
git_oid_iszero
(
&
delta
->
new_file
.
id
));
cl_assert_equal_sz
(
0
,
delta
->
new_file
.
size
);
cl_assert_equal_sz
(
0
,
delta
->
new_file
.
size
);
...
@@ -301,7 +301,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
...
@@ -301,7 +301,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
cl_assert_equal_i
(
GIT_DELTA_ADDED
,
delta
->
status
);
cl_assert_equal_i
(
GIT_DELTA_ADDED
,
delta
->
status
);
cl_assert
(
git_oid_iszero
(
&
delta
->
old_file
.
id
));
cl_assert
(
git_oid_iszero
(
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
0
,
delta
->
old_file
.
size
);
cl_assert_equal_sz
(
0
,
delta
->
old_file
.
size
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
id
)
);
cl_assert
_equal_oid
(
git_blob_id
(
d
),
&
delta
->
new_file
.
id
);
cl_assert_equal_sz
(
git_blob_rawsize
(
d
),
delta
->
new_file
.
size
);
cl_assert_equal_sz
(
git_blob_rawsize
(
d
),
delta
->
new_file
.
size
);
cl_assert_equal_i
(
1
,
(
int
)
git_patch_num_hunks
(
p
));
cl_assert_equal_i
(
1
,
(
int
)
git_patch_num_hunks
(
p
));
...
@@ -392,9 +392,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
...
@@ -392,9 +392,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
cl_assert
(
delta
!=
NULL
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_UNMODIFIED
,
delta
->
status
);
cl_assert_equal_i
(
GIT_DELTA_UNMODIFIED
,
delta
->
status
);
cl_assert_equal_sz
(
delta
->
old_file
.
size
,
git_blob_rawsize
(
d
));
cl_assert_equal_sz
(
delta
->
old_file
.
size
,
git_blob_rawsize
(
d
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
old_file
.
id
)
);
cl_assert
_equal_oid
(
git_blob_id
(
d
),
&
delta
->
old_file
.
id
);
cl_assert_equal_sz
(
delta
->
new_file
.
size
,
git_blob_rawsize
(
d
));
cl_assert_equal_sz
(
delta
->
new_file
.
size
,
git_blob_rawsize
(
d
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
id
)
);
cl_assert
_equal_oid
(
git_blob_id
(
d
),
&
delta
->
new_file
.
id
);
cl_assert_equal_i
(
0
,
(
int
)
git_patch_num_hunks
(
p
));
cl_assert_equal_i
(
0
,
(
int
)
git_patch_num_hunks
(
p
));
git_patch_free
(
p
);
git_patch_free
(
p
);
...
...
tests/diff/iterator.c
View file @
c1bf2942
...
@@ -380,7 +380,7 @@ static void index_iterator_test(
...
@@ -380,7 +380,7 @@ static void index_iterator_test(
if
(
expected_oids
!=
NULL
)
{
if
(
expected_oids
!=
NULL
)
{
git_oid
oid
;
git_oid
oid
;
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
expected_oids
[
count
]));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
expected_oids
[
count
]));
cl_assert_equal_
i
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
),
0
);
cl_assert_equal_
oid
(
&
oid
,
&
entry
->
id
);
}
}
count
++
;
count
++
;
...
...
tests/fetchhead/nonetwork.c
View file @
c1bf2942
...
@@ -120,7 +120,7 @@ static int fetchhead_ref_cb(const char *name, const char *url,
...
@@ -120,7 +120,7 @@ static int fetchhead_ref_cb(const char *name, const char *url,
expected
=
git_vector_get
(
cb_data
->
fetchhead_vector
,
cb_data
->
idx
);
expected
=
git_vector_get
(
cb_data
->
fetchhead_vector
,
cb_data
->
idx
);
cl_assert
(
git_oid_cmp
(
&
expected
->
oid
,
oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected
->
oid
,
oid
);
cl_assert
(
expected
->
is_merge
==
is_merge
);
cl_assert
(
expected
->
is_merge
==
is_merge
);
if
(
expected
->
ref_name
)
if
(
expected
->
ref_name
)
...
@@ -174,7 +174,7 @@ static int read_old_style_cb(const char *name, const char *url,
...
@@ -174,7 +174,7 @@ static int read_old_style_cb(const char *name, const char *url,
cl_assert
(
name
==
NULL
);
cl_assert
(
name
==
NULL
);
cl_assert
(
url
==
NULL
);
cl_assert
(
url
==
NULL
);
cl_assert
(
git_oid_cmp
(
&
expected
,
oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
oid
);
cl_assert
(
is_merge
==
1
);
cl_assert
(
is_merge
==
1
);
return
0
;
return
0
;
...
@@ -201,7 +201,7 @@ static int read_type_missing(const char *ref_name, const char *remote_url,
...
@@ -201,7 +201,7 @@ static int read_type_missing(const char *ref_name, const char *remote_url,
cl_assert_equal_s
(
"name"
,
ref_name
);
cl_assert_equal_s
(
"name"
,
ref_name
);
cl_assert_equal_s
(
"remote_url"
,
remote_url
);
cl_assert_equal_s
(
"remote_url"
,
remote_url
);
cl_assert
(
git_oid_cmp
(
&
expected
,
oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
oid
);
cl_assert
(
is_merge
==
0
);
cl_assert
(
is_merge
==
0
);
return
0
;
return
0
;
...
@@ -228,7 +228,7 @@ static int read_name_missing(const char *ref_name, const char *remote_url,
...
@@ -228,7 +228,7 @@ static int read_name_missing(const char *ref_name, const char *remote_url,
cl_assert
(
ref_name
==
NULL
);
cl_assert
(
ref_name
==
NULL
);
cl_assert_equal_s
(
"remote_url"
,
remote_url
);
cl_assert_equal_s
(
"remote_url"
,
remote_url
);
cl_assert
(
git_oid_cmp
(
&
expected
,
oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
oid
);
cl_assert
(
is_merge
==
0
);
cl_assert
(
is_merge
==
0
);
return
0
;
return
0
;
...
...
tests/index/conflicts.c
View file @
c1bf2942
...
@@ -107,13 +107,13 @@ void test_index_conflicts__get(void)
...
@@ -107,13 +107,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s
(
"conflicts-one.txt"
,
conflict_entry
[
0
]
->
path
);
cl_assert_equal_s
(
"conflicts-one.txt"
,
conflict_entry
[
0
]
->
path
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
0
]
->
id
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_OUR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
1
]
->
id
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
2
]
->
id
);
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
repo_index
,
"conflicts-two.txt"
));
&
conflict_entry
[
2
],
repo_index
,
"conflicts-two.txt"
));
...
@@ -121,13 +121,13 @@ void test_index_conflicts__get(void)
...
@@ -121,13 +121,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s
(
"conflicts-two.txt"
,
conflict_entry
[
0
]
->
path
);
cl_assert_equal_s
(
"conflicts-two.txt"
,
conflict_entry
[
0
]
->
path
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
0
]
->
id
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_OUR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
1
]
->
id
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
2
]
->
id
);
}
}
void
test_index_conflicts__iterate
(
void
)
void
test_index_conflicts__iterate
(
void
)
...
@@ -141,29 +141,29 @@ void test_index_conflicts__iterate(void)
...
@@ -141,29 +141,29 @@ void test_index_conflicts__iterate(void)
cl_git_pass
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
));
cl_git_pass
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
));
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
0
]
->
id
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_OUR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
1
]
->
id
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
2
]
->
id
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
cl_git_pass
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
));
cl_git_pass
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
));
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
0
]
->
id
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_OUR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
1
]
->
id
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
conflict_entry
[
2
]
->
id
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
cl_assert
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
)
==
GIT_ITEROVER
);
cl_assert
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
)
==
GIT_ITEROVER
);
...
@@ -281,7 +281,7 @@ void test_index_conflicts__partial(void)
...
@@ -281,7 +281,7 @@ void test_index_conflicts__partial(void)
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
repo_index
,
"test-one.txt"
));
&
conflict_entry
[
2
],
repo_index
,
"test-one.txt"
));
cl_assert
(
git_oid_cmp
(
&
ancestor_entry
.
id
,
&
conflict_entry
[
0
]
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
ancestor_entry
.
id
,
&
conflict_entry
[
0
]
->
id
);
cl_assert
(
conflict_entry
[
1
]
==
NULL
);
cl_assert
(
conflict_entry
[
1
]
==
NULL
);
cl_assert
(
conflict_entry
[
2
]
==
NULL
);
cl_assert
(
conflict_entry
[
2
]
==
NULL
);
}
}
tests/index/crlf.c
View file @
c1bf2942
...
@@ -41,7 +41,7 @@ void test_index_crlf__autocrlf_false_no_attrs(void)
...
@@ -41,7 +41,7 @@ void test_index_crlf__autocrlf_false_no_attrs(void)
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
(
GIT_EOL_NATIVE
==
GIT_EOL_CRLF
)
?
FILE_OID_CRLF
:
FILE_OID_LF
));
(
GIT_EOL_NATIVE
==
GIT_EOL_CRLF
)
?
FILE_OID_CRLF
:
FILE_OID_LF
));
cl_assert
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
entry
->
id
);
}
}
void
test_index_crlf__autocrlf_true_no_attrs
(
void
)
void
test_index_crlf__autocrlf_true_no_attrs
(
void
)
...
@@ -58,7 +58,7 @@ void test_index_crlf__autocrlf_true_no_attrs(void)
...
@@ -58,7 +58,7 @@ void test_index_crlf__autocrlf_true_no_attrs(void)
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_assert
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
entry
->
id
);
}
}
void
test_index_crlf__autocrlf_input_no_attrs
(
void
)
void
test_index_crlf__autocrlf_input_no_attrs
(
void
)
...
@@ -75,7 +75,7 @@ void test_index_crlf__autocrlf_input_no_attrs(void)
...
@@ -75,7 +75,7 @@ void test_index_crlf__autocrlf_input_no_attrs(void)
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_assert
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
entry
->
id
);
}
}
void
test_index_crlf__autocrlf_false_text_auto_attr
(
void
)
void
test_index_crlf__autocrlf_false_text_auto_attr
(
void
)
...
@@ -94,7 +94,7 @@ void test_index_crlf__autocrlf_false_text_auto_attr(void)
...
@@ -94,7 +94,7 @@ void test_index_crlf__autocrlf_false_text_auto_attr(void)
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_assert
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
entry
->
id
);
}
}
void
test_index_crlf__autocrlf_true_text_auto_attr
(
void
)
void
test_index_crlf__autocrlf_true_text_auto_attr
(
void
)
...
@@ -113,7 +113,7 @@ void test_index_crlf__autocrlf_true_text_auto_attr(void)
...
@@ -113,7 +113,7 @@ void test_index_crlf__autocrlf_true_text_auto_attr(void)
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_assert
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
entry
->
id
);
}
}
void
test_index_crlf__autocrlf_input_text_auto_attr
(
void
)
void
test_index_crlf__autocrlf_input_text_auto_attr
(
void
)
...
@@ -132,7 +132,7 @@ void test_index_crlf__autocrlf_input_text_auto_attr(void)
...
@@ -132,7 +132,7 @@ void test_index_crlf__autocrlf_input_text_auto_attr(void)
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
entry
=
git_index_get_bypath
(
g_index
,
"newfile.txt"
,
0
);
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
FILE_OID_LF
));
cl_assert
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
oid
,
&
entry
->
id
);
}
}
void
test_index_crlf__safecrlf_true_no_attrs
(
void
)
void
test_index_crlf__safecrlf_true_no_attrs
(
void
)
...
...
tests/index/read_tree.c
View file @
c1bf2942
...
@@ -37,7 +37,7 @@ void test_index_read_tree__read_write_involution(void)
...
@@ -37,7 +37,7 @@ void test_index_read_tree__read_write_involution(void)
git_tree_free
(
tree
);
git_tree_free
(
tree
);
cl_git_pass
(
git_index_write_tree
(
&
tree_oid
,
index
));
cl_git_pass
(
git_index_write_tree
(
&
tree_oid
,
index
));
cl_assert
(
git_oid_cmp
(
&
expected
,
&
tree_oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
tree_oid
);
git_index_free
(
index
);
git_index_free
(
index
);
git_repository_free
(
repo
);
git_repository_free
(
repo
);
...
...
tests/index/rename.c
View file @
c1bf2942
...
@@ -27,7 +27,7 @@ void test_index_rename__single_file(void)
...
@@ -27,7 +27,7 @@ void test_index_rename__single_file(void)
cl_assert
(
!
git_index_find
(
&
position
,
index
,
"lame.name.txt"
));
cl_assert
(
!
git_index_find
(
&
position
,
index
,
"lame.name.txt"
));
entry
=
git_index_get_byindex
(
index
,
position
);
entry
=
git_index_get_byindex
(
index
,
position
);
cl_assert
(
git_oid_cmp
(
&
expected
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
entry
->
id
);
/* This removes the entry from the index, but not from the object database */
/* This removes the entry from the index, but not from the object database */
cl_git_pass
(
git_index_remove
(
index
,
"lame.name.txt"
,
0
));
cl_git_pass
(
git_index_remove
(
index
,
"lame.name.txt"
,
0
));
...
@@ -41,7 +41,7 @@ void test_index_rename__single_file(void)
...
@@ -41,7 +41,7 @@ void test_index_rename__single_file(void)
cl_assert
(
!
git_index_find
(
&
position
,
index
,
"fancy.name.txt"
));
cl_assert
(
!
git_index_find
(
&
position
,
index
,
"fancy.name.txt"
));
entry
=
git_index_get_byindex
(
index
,
position
);
entry
=
git_index_get_byindex
(
index
,
position
);
cl_assert
(
git_oid_cmp
(
&
expected
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
entry
->
id
);
git_index_free
(
index
);
git_index_free
(
index
);
git_repository_free
(
repo
);
git_repository_free
(
repo
);
...
...
tests/index/reuc.c
View file @
c1bf2942
...
@@ -53,9 +53,9 @@ void test_index_reuc__add(void)
...
@@ -53,9 +53,9 @@ void test_index_reuc__add(void)
cl_assert
(
reuc
->
mode
[
0
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
0
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
ancestor_oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
ancestor_oid
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
our_oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
our_oid
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
their_oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
their_oid
);
}
}
void
test_index_reuc__add_no_ancestor
(
void
)
void
test_index_reuc__add_no_ancestor
(
void
)
...
@@ -78,9 +78,9 @@ void test_index_reuc__add_no_ancestor(void)
...
@@ -78,9 +78,9 @@ void test_index_reuc__add_no_ancestor(void)
cl_assert
(
reuc
->
mode
[
0
]
==
0
);
cl_assert
(
reuc
->
mode
[
0
]
==
0
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
ancestor_oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
ancestor_oid
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
our_oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
our_oid
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
their_oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
their_oid
);
}
}
void
test_index_reuc__read_bypath
(
void
)
void
test_index_reuc__read_bypath
(
void
)
...
@@ -97,11 +97,11 @@ void test_index_reuc__read_bypath(void)
...
@@ -97,11 +97,11 @@ void test_index_reuc__read_bypath(void)
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
oid
);
cl_assert
(
reuc
=
git_index_reuc_get_bypath
(
repo_index
,
"one.txt"
));
cl_assert
(
reuc
=
git_index_reuc_get_bypath
(
repo_index
,
"one.txt"
));
...
@@ -110,11 +110,11 @@ void test_index_reuc__read_bypath(void)
...
@@ -110,11 +110,11 @@ void test_index_reuc__read_bypath(void)
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
git_oid_fromstr
(
&
oid
,
ONE_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
ONE_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
oid
);
git_oid_fromstr
(
&
oid
,
ONE_OUR_OID
);
git_oid_fromstr
(
&
oid
,
ONE_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
oid
);
git_oid_fromstr
(
&
oid
,
ONE_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
ONE_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
oid
);
}
}
void
test_index_reuc__ignore_case
(
void
)
void
test_index_reuc__ignore_case
(
void
)
...
@@ -142,11 +142,11 @@ void test_index_reuc__ignore_case(void)
...
@@ -142,11 +142,11 @@ void test_index_reuc__ignore_case(void)
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
oid
);
}
}
void
test_index_reuc__read_byindex
(
void
)
void
test_index_reuc__read_byindex
(
void
)
...
@@ -163,11 +163,11 @@ void test_index_reuc__read_byindex(void)
...
@@ -163,11 +163,11 @@ void test_index_reuc__read_byindex(void)
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
git_oid_fromstr
(
&
oid
,
ONE_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
ONE_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
oid
);
git_oid_fromstr
(
&
oid
,
ONE_OUR_OID
);
git_oid_fromstr
(
&
oid
,
ONE_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
oid
);
git_oid_fromstr
(
&
oid
,
ONE_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
ONE_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
oid
);
cl_assert
(
reuc
=
git_index_reuc_get_byindex
(
repo_index
,
1
));
cl_assert
(
reuc
=
git_index_reuc_get_byindex
(
repo_index
,
1
));
...
@@ -176,11 +176,11 @@ void test_index_reuc__read_byindex(void)
...
@@ -176,11 +176,11 @@ void test_index_reuc__read_byindex(void)
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
oid
);
}
}
void
test_index_reuc__updates_existing
(
void
)
void
test_index_reuc__updates_existing
(
void
)
...
@@ -216,11 +216,11 @@ void test_index_reuc__updates_existing(void)
...
@@ -216,11 +216,11 @@ void test_index_reuc__updates_existing(void)
cl_assert_equal_s
(
"TWO.txt"
,
reuc
->
path
);
cl_assert_equal_s
(
"TWO.txt"
,
reuc
->
path
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
oid
);
}
}
void
test_index_reuc__remove
(
void
)
void
test_index_reuc__remove
(
void
)
...
@@ -242,11 +242,11 @@ void test_index_reuc__remove(void)
...
@@ -242,11 +242,11 @@ void test_index_reuc__remove(void)
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
1
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
cl_assert
(
reuc
->
mode
[
2
]
==
0100644
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
0
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
0
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
1
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
1
],
&
oid
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
git_oid_fromstr
(
&
oid
,
TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
reuc
->
oid
[
2
],
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
reuc
->
oid
[
2
],
&
oid
);
}
}
void
test_index_reuc__write
(
void
)
void
test_index_reuc__write
(
void
)
...
...
tests/index/tests.c
View file @
c1bf2942
...
@@ -243,11 +243,11 @@ void test_index_tests__add(void)
...
@@ -243,11 +243,11 @@ void test_index_tests__add(void)
entry
=
git_index_get_byindex
(
index
,
0
);
entry
=
git_index_get_byindex
(
index
,
0
);
/* And the built-in hashing mechanism worked as expected */
/* And the built-in hashing mechanism worked as expected */
cl_assert
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
id1
,
&
entry
->
id
);
/* Test access by path instead of index */
/* Test access by path instead of index */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"test.txt"
,
0
))
!=
NULL
);
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"test.txt"
,
0
))
!=
NULL
);
cl_assert
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
);
cl_assert
_equal_oid
(
&
id1
,
&
entry
->
id
);
git_index_free
(
index
);
git_index_free
(
index
);
git_repository_free
(
repo
);
git_repository_free
(
repo
);
...
@@ -283,14 +283,14 @@ void test_index_tests__add_issue_1397(void)
...
@@ -283,14 +283,14 @@ void test_index_tests__add_issue_1397(void)
/* Make sure the initial SHA-1 is correct */
/* Make sure the initial SHA-1 is correct */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"crlf_file.txt"
,
0
))
!=
NULL
);
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"crlf_file.txt"
,
0
))
!=
NULL
);
cl_assert_
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
,
"first oid check"
);
cl_assert_
equal_oid
(
&
id1
,
&
entry
->
id
);
/* Update the index */
/* Update the index */
cl_git_pass
(
git_index_add_bypath
(
index
,
"crlf_file.txt"
));
cl_git_pass
(
git_index_add_bypath
(
index
,
"crlf_file.txt"
));
/* Check the new SHA-1 */
/* Check the new SHA-1 */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"crlf_file.txt"
,
0
))
!=
NULL
);
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"crlf_file.txt"
,
0
))
!=
NULL
);
cl_assert_
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
,
"second oid check"
);
cl_assert_
equal_oid
(
&
id1
,
&
entry
->
id
);
git_index_free
(
index
);
git_index_free
(
index
);
}
}
...
...
tests/merge/trees/trivial.c
View file @
c1bf2942
...
@@ -259,7 +259,7 @@ void test_merge_trees_trivial__13(void)
...
@@ -259,7 +259,7 @@ void test_merge_trees_trivial__13(void)
cl_assert
(
entry
=
git_index_get_bypath
(
result
,
"modified-in-13.txt"
,
0
));
cl_assert
(
entry
=
git_index_get_bypath
(
result
,
"modified-in-13.txt"
,
0
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
"1cff9ec6a47a537380dedfdd17c9e76d74259a2b"
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
"1cff9ec6a47a537380dedfdd17c9e76d74259a2b"
));
cl_assert
(
git_oid_cmp
(
&
entry
->
id
,
&
expected_oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected_oid
,
&
entry
->
id
);
cl_assert
(
git_index_reuc_entrycount
(
result
)
==
0
);
cl_assert
(
git_index_reuc_entrycount
(
result
)
==
0
);
cl_assert
(
merge_trivial_conflict_entrycount
(
result
)
==
0
);
cl_assert
(
merge_trivial_conflict_entrycount
(
result
)
==
0
);
...
...
tests/notes/notes.c
View file @
c1bf2942
...
@@ -21,7 +21,7 @@ static void assert_note_equal(git_note *note, char *message, git_oid *note_oid)
...
@@ -21,7 +21,7 @@ static void assert_note_equal(git_note *note, char *message, git_oid *note_oid)
git_blob
*
blob
;
git_blob
*
blob
;
cl_assert_equal_s
(
git_note_message
(
note
),
message
);
cl_assert_equal_s
(
git_note_message
(
note
),
message
);
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
note
),
note_oid
)
);
cl_assert
_equal_oid
(
git_note_id
(
note
),
note_oid
);
cl_git_pass
(
git_blob_lookup
(
&
blob
,
_repo
,
note_oid
));
cl_git_pass
(
git_blob_lookup
(
&
blob
,
_repo
,
note_oid
));
cl_assert_equal_s
(
git_note_message
(
note
),
(
const
char
*
)
git_blob_rawcontent
(
blob
));
cl_assert_equal_s
(
git_note_message
(
note
),
(
const
char
*
)
git_blob_rawcontent
(
blob
));
...
@@ -61,10 +61,10 @@ static int note_list_cb(
...
@@ -61,10 +61,10 @@ static int note_list_cb(
cl_assert
(
*
count
<
EXPECTATIONS_COUNT
);
cl_assert
(
*
count
<
EXPECTATIONS_COUNT
);
cl_git_pass
(
git_oid_fromstr
(
&
expected_note_oid
,
list_expectations
[
*
count
].
note_sha
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_note_oid
,
list_expectations
[
*
count
].
note_sha
));
cl_assert
(
git_oid_cmp
(
&
expected_note_oid
,
blob_id
)
==
0
);
cl_assert
_equal_oid
(
&
expected_note_oid
,
blob_id
);
cl_git_pass
(
git_oid_fromstr
(
&
expected_target_oid
,
list_expectations
[
*
count
].
annotated_object_sha
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_target_oid
,
list_expectations
[
*
count
].
annotated_object_sha
));
cl_assert
(
git_oid_cmp
(
&
expected_target_oid
,
annotated_obj_id
)
==
0
);
cl_assert
_equal_oid
(
&
expected_target_oid
,
annotated_obj_id
);
(
*
count
)
++
;
(
*
count
)
++
;
...
@@ -290,7 +290,7 @@ void test_notes_notes__can_read_a_note_in_an_existing_fanout(void)
...
@@ -290,7 +290,7 @@ void test_notes_notes__can_read_a_note_in_an_existing_fanout(void)
cl_git_pass
(
git_note_read
(
&
note
,
_repo
,
"refs/notes/fanout"
,
&
target_oid
));
cl_git_pass
(
git_note_read
(
&
note
,
_repo
,
"refs/notes/fanout"
,
&
target_oid
));
cl_git_pass
(
git_oid_fromstr
(
&
note_oid
,
"08b041783f40edfe12bb406c9c9a8a040177c125"
));
cl_git_pass
(
git_oid_fromstr
(
&
note_oid
,
"08b041783f40edfe12bb406c9c9a8a040177c125"
));
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
note
),
&
note_oid
)
);
cl_assert
_equal_oid
(
git_note_id
(
note
),
&
note_oid
);
git_note_free
(
note
);
git_note_free
(
note
);
}
}
...
...
tests/notes/notesref.c
View file @
c1bf2942
...
@@ -46,13 +46,13 @@ void test_notes_notesref__config_corenotesref(void)
...
@@ -46,13 +46,13 @@ void test_notes_notesref__config_corenotesref(void)
cl_git_pass
(
git_note_read
(
&
_note
,
_repo
,
NULL
,
&
oid
));
cl_git_pass
(
git_note_read
(
&
_note
,
_repo
,
NULL
,
&
oid
));
cl_assert_equal_s
(
"test123test
\n
"
,
git_note_message
(
_note
));
cl_assert_equal_s
(
"test123test
\n
"
,
git_note_message
(
_note
));
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
_note
),
&
note_oid
)
);
cl_assert
_equal_oid
(
git_note_id
(
_note
),
&
note_oid
);
git_note_free
(
_note
);
git_note_free
(
_note
);
cl_git_pass
(
git_note_read
(
&
_note
,
_repo
,
"refs/notes/mydefaultnotesref"
,
&
oid
));
cl_git_pass
(
git_note_read
(
&
_note
,
_repo
,
"refs/notes/mydefaultnotesref"
,
&
oid
));
cl_assert_equal_s
(
"test123test
\n
"
,
git_note_message
(
_note
));
cl_assert_equal_s
(
"test123test
\n
"
,
git_note_message
(
_note
));
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
_note
),
&
note_oid
)
);
cl_assert
_equal_oid
(
git_note_id
(
_note
),
&
note_oid
);
cl_git_pass
(
git_note_default_ref
(
&
default_ref
,
_repo
));
cl_git_pass
(
git_note_default_ref
(
&
default_ref
,
_repo
));
cl_assert_equal_s
(
"refs/notes/mydefaultnotesref"
,
default_ref
);
cl_assert_equal_s
(
"refs/notes/mydefaultnotesref"
,
default_ref
);
...
...
tests/object/lookupbypath.c
View file @
c1bf2942
...
@@ -52,16 +52,16 @@ void test_object_lookupbypath__from_root_tree(void)
...
@@ -52,16 +52,16 @@ void test_object_lookupbypath__from_root_tree(void)
{
{
cl_git_pass
(
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
g_root_tree
,
cl_git_pass
(
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
g_root_tree
,
"subdir/subdir_test2.txt"
,
GIT_OBJ_BLOB
));
"subdir/subdir_test2.txt"
,
GIT_OBJ_BLOB
));
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
git_object_id
(
g_expectedobject
),
cl_assert_equal_
oid
(
git_object_id
(
g_expectedobject
),
git_object_id
(
g_actualobject
)
));
git_object_id
(
g_actualobject
));
}
}
void
test_object_lookupbypath__from_head_commit
(
void
)
void
test_object_lookupbypath__from_head_commit
(
void
)
{
{
cl_git_pass
(
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
g_head_commit
,
cl_git_pass
(
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
g_head_commit
,
"subdir/subdir_test2.txt"
,
GIT_OBJ_BLOB
));
"subdir/subdir_test2.txt"
,
GIT_OBJ_BLOB
));
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
git_object_id
(
g_expectedobject
),
cl_assert_equal_
oid
(
git_object_id
(
g_expectedobject
),
git_object_id
(
g_actualobject
))
)
;
git_object_id
(
g_actualobject
));
}
}
void
test_object_lookupbypath__from_subdir_tree
(
void
)
void
test_object_lookupbypath__from_subdir_tree
(
void
)
...
@@ -74,8 +74,8 @@ void test_object_lookupbypath__from_subdir_tree(void)
...
@@ -74,8 +74,8 @@ void test_object_lookupbypath__from_subdir_tree(void)
cl_git_pass
(
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
tree
,
cl_git_pass
(
git_object_lookup_bypath
(
&
g_actualobject
,
(
git_object
*
)
tree
,
"subdir_test2.txt"
,
GIT_OBJ_BLOB
));
"subdir_test2.txt"
,
GIT_OBJ_BLOB
));
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
git_object_id
(
g_expectedobject
),
cl_assert_equal_
oid
(
git_object_id
(
g_expectedobject
),
git_object_id
(
g_actualobject
))
)
;
git_object_id
(
g_actualobject
));
git_tree_entry_free
(
entry
);
git_tree_entry_free
(
entry
);
git_tree_free
(
tree
);
git_tree_free
(
tree
);
...
...
tests/object/peel.c
View file @
c1bf2942
...
@@ -29,7 +29,7 @@ static void assert_peel(
...
@@ -29,7 +29,7 @@ static void assert_peel(
cl_git_pass
(
git_object_peel
(
&
peeled
,
obj
,
requested_type
));
cl_git_pass
(
git_object_peel
(
&
peeled
,
obj
,
requested_type
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
expected_sha
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
expected_sha
));
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
&
expected_oid
,
git_object_id
(
peeled
)
));
cl_assert_equal_
oid
(
&
expected_oid
,
git_object_id
(
peeled
));
cl_assert_equal_i
(
expected_type
,
git_object_type
(
peeled
));
cl_assert_equal_i
(
expected_type
,
git_object_type
(
peeled
));
...
...
tests/odb/mixed.c
View file @
c1bf2942
...
@@ -58,7 +58,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
...
@@ -58,7 +58,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
hex
,
strlen
(
hex
)));
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
hex
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_read_prefix
(
&
obj
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_read_prefix
(
&
obj
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_exists_prefix
(
&
found
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_exists_prefix
(
&
found
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_assert
(
git_oid_equal
(
&
found
,
git_odb_object_id
(
obj
)
));
cl_assert
_equal_oid
(
&
found
,
git_odb_object_id
(
obj
));
git_odb_object_free
(
obj
);
git_odb_object_free
(
obj
);
strncpy
(
hex
,
"dea509d0b"
,
sizeof
(
hex
));
strncpy
(
hex
,
"dea509d0b"
,
sizeof
(
hex
));
...
@@ -79,7 +79,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
...
@@ -79,7 +79,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
hex
,
strlen
(
hex
)));
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
hex
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_read_prefix
(
&
obj
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_read_prefix
(
&
obj
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_exists_prefix
(
&
found
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_exists_prefix
(
&
found
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_assert
(
git_oid_equal
(
&
found
,
git_odb_object_id
(
obj
)
));
cl_assert
_equal_oid
(
&
found
,
git_odb_object_id
(
obj
));
git_odb_object_free
(
obj
);
git_odb_object_free
(
obj
);
strncpy
(
hex
,
"81b5bff5f"
,
sizeof
(
hex
));
strncpy
(
hex
,
"81b5bff5f"
,
sizeof
(
hex
));
...
@@ -100,7 +100,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
...
@@ -100,7 +100,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
hex
,
strlen
(
hex
)));
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
hex
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_read_prefix
(
&
obj
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_read_prefix
(
&
obj
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_exists_prefix
(
&
found
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_git_pass
(
git_odb_exists_prefix
(
&
found
,
_odb
,
&
oid
,
strlen
(
hex
)));
cl_assert
(
git_oid_equal
(
&
found
,
git_odb_object_id
(
obj
)
));
cl_assert
_equal_oid
(
&
found
,
git_odb_object_id
(
obj
));
git_odb_object_free
(
obj
);
git_odb_object_free
(
obj
);
strncpy
(
hex
,
"0ddeadede"
,
sizeof
(
hex
));
strncpy
(
hex
,
"0ddeadede"
,
sizeof
(
hex
));
...
...
tests/pack/indexer.c
View file @
c1bf2942
...
@@ -74,7 +74,7 @@ void test_pack_indexer__fix_thin(void)
...
@@ -74,7 +74,7 @@ void test_pack_indexer__fix_thin(void)
/* Store the missing base into your ODB so the indexer can fix the pack */
/* Store the missing base into your ODB so the indexer can fix the pack */
cl_git_pass
(
git_odb_write
(
&
id
,
odb
,
base_obj
,
base_obj_len
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_write
(
&
id
,
odb
,
base_obj
,
base_obj_len
,
GIT_OBJ_BLOB
));
git_oid_fromstr
(
&
should_id
,
"e68fe8129b546b101aee9510c5328e7f21ca1d18"
);
git_oid_fromstr
(
&
should_id
,
"e68fe8129b546b101aee9510c5328e7f21ca1d18"
);
cl_assert
(
!
git_oid_cmp
(
&
id
,
&
should_id
)
);
cl_assert
_equal_oid
(
&
should_id
,
&
id
);
cl_git_pass
(
git_indexer_new
(
&
idx
,
"."
,
0
,
odb
,
NULL
,
NULL
));
cl_git_pass
(
git_indexer_new
(
&
idx
,
"."
,
0
,
odb
,
NULL
,
NULL
));
cl_git_pass
(
git_indexer_append
(
idx
,
thin_pack
,
thin_pack_len
,
&
stats
));
cl_git_pass
(
git_indexer_append
(
idx
,
thin_pack
,
thin_pack_len
,
&
stats
));
...
@@ -86,7 +86,7 @@ void test_pack_indexer__fix_thin(void)
...
@@ -86,7 +86,7 @@ void test_pack_indexer__fix_thin(void)
cl_assert_equal_i
(
stats
.
local_objects
,
1
);
cl_assert_equal_i
(
stats
.
local_objects
,
1
);
git_oid_fromstr
(
&
should_id
,
"11f0f69b334728fdd8bc86b80499f22f29d85b15"
);
git_oid_fromstr
(
&
should_id
,
"11f0f69b334728fdd8bc86b80499f22f29d85b15"
);
cl_assert
(
!
git_oid_cmp
(
git_indexer_hash
(
idx
),
&
should_id
));
cl_assert
_equal_oid
(
&
should_id
,
git_indexer_hash
(
idx
));
git_indexer_free
(
idx
);
git_indexer_free
(
idx
);
git_odb_free
(
odb
);
git_odb_free
(
odb
);
...
...
tests/refs/create.c
View file @
c1bf2942
...
@@ -45,7 +45,7 @@ void test_refs_create__symbolic(void)
...
@@ -45,7 +45,7 @@ void test_refs_create__symbolic(void)
cl_assert
(
git_reference_type
(
resolved_ref
)
==
GIT_REF_OID
);
cl_assert
(
git_reference_type
(
resolved_ref
)
==
GIT_REF_OID
);
/* ...and that it points to the current master tip */
/* ...and that it points to the current master tip */
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
resolved_ref
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
resolved_ref
)
);
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
git_reference_free
(
resolved_ref
);
git_reference_free
(
resolved_ref
);
...
@@ -54,7 +54,7 @@ void test_refs_create__symbolic(void)
...
@@ -54,7 +54,7 @@ void test_refs_create__symbolic(void)
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
repo2
,
new_head_tracker
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
repo2
,
new_head_tracker
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
looked_up_ref
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
looked_up_ref
));
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
resolved_ref
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
resolved_ref
)
);
git_repository_free
(
repo2
);
git_repository_free
(
repo2
);
...
@@ -76,7 +76,7 @@ void test_refs_create__deep_symbolic(void)
...
@@ -76,7 +76,7 @@ void test_refs_create__deep_symbolic(void)
cl_git_pass
(
git_reference_symbolic_create
(
&
new_reference
,
g_repo
,
new_head_tracker
,
current_head_target
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
new_reference
,
g_repo
,
new_head_tracker
,
current_head_target
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head_tracker
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head_tracker
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
looked_up_ref
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
looked_up_ref
));
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
resolved_ref
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
resolved_ref
)
);
git_reference_free
(
new_reference
);
git_reference_free
(
new_reference
);
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
...
@@ -104,14 +104,14 @@ void test_refs_create__oid(void)
...
@@ -104,14 +104,14 @@ void test_refs_create__oid(void)
cl_assert_equal_s
(
looked_up_ref
->
name
,
new_head
);
cl_assert_equal_s
(
looked_up_ref
->
name
,
new_head
);
/* ...and that it points to the current master tip */
/* ...and that it points to the current master tip */
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
looked_up_ref
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
looked_up_ref
)
);
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
/* Similar test with a fresh new repository */
/* Similar test with a fresh new repository */
cl_git_pass
(
git_repository_open
(
&
repo2
,
"testrepo"
));
cl_git_pass
(
git_repository_open
(
&
repo2
,
"testrepo"
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
repo2
,
new_head
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
repo2
,
new_head
));
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
looked_up_ref
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
looked_up_ref
)
);
git_repository_free
(
repo2
);
git_repository_free
(
repo2
);
...
...
tests/refs/createwithlog.c
View file @
c1bf2942
...
@@ -42,7 +42,7 @@ void test_refs_createwithlog__creating_a_direct_reference_adds_a_reflog_entry(vo
...
@@ -42,7 +42,7 @@ void test_refs_createwithlog__creating_a_direct_reference_adds_a_reflog_entry(vo
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
cl_assert
(
git_oid_streq
(
&
entry
->
oid_old
,
GIT_OID_HEX_ZERO
)
==
0
);
cl_assert
(
git_oid_streq
(
&
entry
->
oid_old
,
GIT_OID_HEX_ZERO
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
id
,
&
entry
->
oid_cur
)
==
0
);
cl_assert
_equal_oid
(
&
id
,
&
entry
->
oid_cur
);
cl_assert_equal_s
(
message
,
entry
->
msg
);
cl_assert_equal_s
(
message
,
entry
->
msg
);
git_reflog_free
(
reflog
);
git_reflog_free
(
reflog
);
...
...
tests/refs/lookup.c
View file @
c1bf2942
...
@@ -44,7 +44,7 @@ void test_refs_lookup__oid(void)
...
@@ -44,7 +44,7 @@ void test_refs_lookup__oid(void)
cl_git_pass
(
git_reference_name_to_id
(
&
tag
,
g_repo
,
"refs/tags/point_to_blob"
));
cl_git_pass
(
git_reference_name_to_id
(
&
tag
,
g_repo
,
"refs/tags/point_to_blob"
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"1385f264afb75a56a5bec74243be9b367ba4ca08"
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"1385f264afb75a56a5bec74243be9b367ba4ca08"
));
cl_assert
(
git_oid_cmp
(
&
tag
,
&
expected
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
tag
);
}
}
void
test_refs_lookup__namespace
(
void
)
void
test_refs_lookup__namespace
(
void
)
...
...
tests/refs/overwrite.c
View file @
c1bf2942
...
@@ -78,7 +78,7 @@ void test_refs_overwrite__object_id(void)
...
@@ -78,7 +78,7 @@ void test_refs_overwrite__object_id(void)
/* Ensure it has been overwritten */
/* Ensure it has been overwritten */
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_name
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_name
));
cl_assert
(
!
git_oid_cmp
(
&
id
,
git_reference_target
(
ref
)
));
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
ref
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
...
@@ -130,7 +130,7 @@ void test_refs_overwrite__symbolic_with_object_id(void)
...
@@ -130,7 +130,7 @@ void test_refs_overwrite__symbolic_with_object_id(void)
/* Ensure it points to the right place */
/* Ensure it points to the right place */
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_name
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_name
));
cl_assert
(
git_reference_type
(
ref
)
&
GIT_REF_OID
);
cl_assert
(
git_reference_type
(
ref
)
&
GIT_REF_OID
);
cl_assert
(
!
git_oid_cmp
(
git_reference_target
(
ref
),
&
id
));
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
ref
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
tests/refs/peel.c
View file @
c1bf2942
...
@@ -33,7 +33,7 @@ static void assert_peel_generic(
...
@@ -33,7 +33,7 @@ static void assert_peel_generic(
cl_git_pass
(
git_reference_peel
(
&
peeled
,
ref
,
requested_type
));
cl_git_pass
(
git_reference_peel
(
&
peeled
,
ref
,
requested_type
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
expected_sha
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
expected_sha
));
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
&
expected_oid
,
git_object_id
(
peeled
)
));
cl_assert_equal_
oid
(
&
expected_oid
,
git_object_id
(
peeled
));
cl_assert_equal_i
(
expected_type
,
git_object_type
(
peeled
));
cl_assert_equal_i
(
expected_type
,
git_object_type
(
peeled
));
...
...
tests/refs/read.c
View file @
c1bf2942
...
@@ -83,7 +83,7 @@ void test_refs_read__symbolic(void)
...
@@ -83,7 +83,7 @@ void test_refs_read__symbolic(void)
cl_assert
(
git_object_type
(
object
)
==
GIT_OBJ_COMMIT
);
cl_assert
(
git_object_type
(
object
)
==
GIT_OBJ_COMMIT
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_object_id
(
object
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_object_id
(
object
)
);
git_object_free
(
object
);
git_object_free
(
object
);
...
@@ -111,7 +111,7 @@ void test_refs_read__nested_symbolic(void)
...
@@ -111,7 +111,7 @@ void test_refs_read__nested_symbolic(void)
cl_assert
(
git_object_type
(
object
)
==
GIT_OBJ_COMMIT
);
cl_assert
(
git_object_type
(
object
)
==
GIT_OBJ_COMMIT
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_object_id
(
object
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_object_id
(
object
)
);
git_object_free
(
object
);
git_object_free
(
object
);
...
@@ -130,13 +130,13 @@ void test_refs_read__head_then_master(void)
...
@@ -130,13 +130,13 @@ void test_refs_read__head_then_master(void)
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_
git_pass
(
git_oid_cmp
(
git_reference_target
(
comp_base_ref
),
git_reference_target
(
resolved_ref
)
));
cl_
assert_equal_oid
(
git_reference_target
(
comp_base_ref
),
git_reference_target
(
resolved_ref
));
git_reference_free
(
reference
);
git_reference_free
(
reference
);
git_reference_free
(
resolved_ref
);
git_reference_free
(
resolved_ref
);
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
current_head_target
));
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
current_head_target
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_
git_pass
(
git_oid_cmp
(
git_reference_target
(
comp_base_ref
),
git_reference_target
(
resolved_ref
)
));
cl_
assert_equal_oid
(
git_reference_target
(
comp_base_ref
),
git_reference_target
(
resolved_ref
));
git_reference_free
(
reference
);
git_reference_free
(
reference
);
git_reference_free
(
resolved_ref
);
git_reference_free
(
resolved_ref
);
...
@@ -152,7 +152,7 @@ void test_refs_read__master_then_head(void)
...
@@ -152,7 +152,7 @@ void test_refs_read__master_then_head(void)
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_reference_lookup
(
&
reference
,
g_repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
reference
));
cl_
git_pass
(
git_oid_cmp
(
git_reference_target
(
master_ref
),
git_reference_target
(
resolved_ref
)
));
cl_
assert_equal_oid
(
git_reference_target
(
master_ref
),
git_reference_target
(
resolved_ref
));
git_reference_free
(
reference
);
git_reference_free
(
reference
);
git_reference_free
(
resolved_ref
);
git_reference_free
(
resolved_ref
);
...
@@ -201,7 +201,7 @@ void test_refs_read__chomped(void)
...
@@ -201,7 +201,7 @@ void test_refs_read__chomped(void)
cl_git_pass
(
git_reference_lookup
(
&
test
,
g_repo
,
"refs/heads/test"
));
cl_git_pass
(
git_reference_lookup
(
&
test
,
g_repo
,
"refs/heads/test"
));
cl_git_pass
(
git_reference_lookup
(
&
chomped
,
g_repo
,
"refs/heads/chomped"
));
cl_git_pass
(
git_reference_lookup
(
&
chomped
,
g_repo
,
"refs/heads/chomped"
));
cl_
git_pass
(
git_oid_cmp
(
git_reference_target
(
test
),
git_reference_target
(
chomped
)
));
cl_
assert_equal_oid
(
git_reference_target
(
test
),
git_reference_target
(
chomped
));
git_reference_free
(
test
);
git_reference_free
(
test
);
git_reference_free
(
chomped
);
git_reference_free
(
chomped
);
...
@@ -213,7 +213,7 @@ void test_refs_read__trailing(void)
...
@@ -213,7 +213,7 @@ void test_refs_read__trailing(void)
cl_git_pass
(
git_reference_lookup
(
&
test
,
g_repo
,
"refs/heads/test"
));
cl_git_pass
(
git_reference_lookup
(
&
test
,
g_repo
,
"refs/heads/test"
));
cl_git_pass
(
git_reference_lookup
(
&
trailing
,
g_repo
,
"refs/heads/trailing"
));
cl_git_pass
(
git_reference_lookup
(
&
trailing
,
g_repo
,
"refs/heads/trailing"
));
cl_
git_pass
(
git_oid_cmp
(
git_reference_target
(
test
),
git_reference_target
(
trailing
)
));
cl_
assert_equal_oid
(
git_reference_target
(
test
),
git_reference_target
(
trailing
));
git_reference_free
(
trailing
);
git_reference_free
(
trailing
);
cl_git_pass
(
git_reference_lookup
(
&
trailing
,
g_repo
,
"FETCH_HEAD"
));
cl_git_pass
(
git_reference_lookup
(
&
trailing
,
g_repo
,
"FETCH_HEAD"
));
...
...
tests/refs/rename.c
View file @
c1bf2942
...
@@ -220,7 +220,7 @@ void test_refs_rename__force_loose_packed(void)
...
@@ -220,7 +220,7 @@ void test_refs_rename__force_loose_packed(void)
/* Check we actually renamed it */
/* Check we actually renamed it */
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
));
cl_assert_equal_s
(
looked_up_ref
->
name
,
packed_test_head_name
);
cl_assert_equal_s
(
looked_up_ref
->
name
,
packed_test_head_name
);
cl_assert
(
!
git_oid_cmp
(
&
oid
,
git_reference_target
(
looked_up_ref
)
));
cl_assert
_equal_oid
(
&
oid
,
git_reference_target
(
looked_up_ref
));
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
/* And that the previous one doesn't exist any longer */
/* And that the previous one doesn't exist any longer */
...
@@ -245,7 +245,7 @@ void test_refs_rename__force_loose(void)
...
@@ -245,7 +245,7 @@ void test_refs_rename__force_loose(void)
/* Check we actually renamed it */
/* Check we actually renamed it */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
"refs/heads/test"
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
"refs/heads/test"
));
cl_assert_equal_s
(
looked_up_ref
->
name
,
"refs/heads/test"
);
cl_assert_equal_s
(
looked_up_ref
->
name
,
"refs/heads/test"
);
cl_assert
(
!
git_oid_cmp
(
&
oid
,
git_reference_target
(
looked_up_ref
)
));
cl_assert
_equal_oid
(
&
oid
,
git_reference_target
(
looked_up_ref
));
git_reference_free
(
looked_up_ref
);
git_reference_free
(
looked_up_ref
);
/* And that the previous one doesn't exist any longer */
/* And that the previous one doesn't exist any longer */
...
...
tests/refs/settargetwithlog.c
View file @
c1bf2942
...
@@ -44,8 +44,8 @@ void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry
...
@@ -44,8 +44,8 @@ void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry
cl_git_pass
(
git_reflog_read
(
&
reflog
,
g_repo
,
br2_name
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
g_repo
,
br2_name
));
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
cl_assert
(
git_oid_cmp
(
&
current_id
,
&
entry
->
oid_old
)
==
0
);
cl_assert
_equal_oid
(
&
current_id
,
&
entry
->
oid_old
);
cl_assert
(
git_oid_cmp
(
&
target_id
,
&
entry
->
oid_cur
)
==
0
);
cl_assert
_equal_oid
(
&
target_id
,
&
entry
->
oid_cur
);
cl_assert_equal_s
(
message
,
entry
->
msg
);
cl_assert_equal_s
(
message
,
entry
->
msg
);
git_reflog_free
(
reflog
);
git_reflog_free
(
reflog
);
...
...
tests/refs/setter.c
View file @
c1bf2942
...
@@ -41,7 +41,7 @@ void test_refs_setter__update_direct(void)
...
@@ -41,7 +41,7 @@ void test_refs_setter__update_direct(void)
cl_git_pass
(
git_reference_lookup
(
&
test_ref
,
g_repo
,
ref_test_name
));
cl_git_pass
(
git_reference_lookup
(
&
test_ref
,
g_repo
,
ref_test_name
));
cl_assert
(
git_reference_type
(
test_ref
)
==
GIT_REF_OID
);
cl_assert
(
git_reference_type
(
test_ref
)
==
GIT_REF_OID
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
test_ref
))
==
0
);
cl_assert
_equal_oid
(
&
id
,
git_reference_target
(
test_ref
)
);
git_reference_free
(
test_ref
);
git_reference_free
(
test_ref
);
}
}
...
...
tests/refs/unicode.c
View file @
c1bf2942
...
@@ -32,8 +32,7 @@ void test_refs_unicode__create_and_lookup(void)
...
@@ -32,8 +32,7 @@ void test_refs_unicode__create_and_lookup(void)
cl_git_pass
(
git_repository_open
(
&
repo2
,
"testrepo.git"
));
cl_git_pass
(
git_repository_open
(
&
repo2
,
"testrepo.git"
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo2
,
REFNAME
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo2
,
REFNAME
));
cl_assert_equal_i
(
cl_assert_equal_oid
(
git_reference_target
(
ref1
),
git_reference_target
(
ref2
));
0
,
git_oid_cmp
(
git_reference_target
(
ref1
),
git_reference_target
(
ref2
)));
cl_assert_equal_s
(
REFNAME
,
git_reference_name
(
ref2
));
cl_assert_equal_s
(
REFNAME
,
git_reference_name
(
ref2
));
git_reference_free
(
ref2
);
git_reference_free
(
ref2
);
...
@@ -43,8 +42,7 @@ void test_refs_unicode__create_and_lookup(void)
...
@@ -43,8 +42,7 @@ void test_refs_unicode__create_and_lookup(void)
#define REFNAME_DECOMPOSED "refs/heads/" "A" "\314\212" "ngstro" "\314\210" "m"
#define REFNAME_DECOMPOSED "refs/heads/" "A" "\314\212" "ngstro" "\314\210" "m"
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo2
,
REFNAME_DECOMPOSED
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo2
,
REFNAME_DECOMPOSED
));
cl_assert_equal_i
(
cl_assert_equal_oid
(
git_reference_target
(
ref1
),
git_reference_target
(
ref2
));
0
,
git_oid_cmp
(
git_reference_target
(
ref1
),
git_reference_target
(
ref2
)));
cl_assert_equal_s
(
REFNAME
,
git_reference_name
(
ref2
));
cl_assert_equal_s
(
REFNAME
,
git_reference_name
(
ref2
));
git_reference_free
(
ref2
);
git_reference_free
(
ref2
);
#endif
#endif
...
...
tests/repo/hashfile.c
View file @
c1bf2942
...
@@ -22,14 +22,14 @@ void test_repo_hashfile__simple(void)
...
@@ -22,14 +22,14 @@ void test_repo_hashfile__simple(void)
/* hash with repo relative path */
/* hash with repo relative path */
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/current_file"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/current_file"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"current_file"
,
GIT_OBJ_BLOB
,
NULL
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"current_file"
,
GIT_OBJ_BLOB
,
NULL
));
cl_assert
(
git_oid_equal
(
&
a
,
&
b
)
);
cl_assert
_equal_oid
(
&
a
,
&
b
);
cl_git_pass
(
git_buf_joinpath
(
&
full
,
git_repository_workdir
(
_repo
),
"current_file"
));
cl_git_pass
(
git_buf_joinpath
(
&
full
,
git_repository_workdir
(
_repo
),
"current_file"
));
/* hash with full path */
/* hash with full path */
cl_git_pass
(
git_odb_hashfile
(
&
a
,
full
.
ptr
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
a
,
full
.
ptr
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
full
.
ptr
,
GIT_OBJ_BLOB
,
NULL
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
full
.
ptr
,
GIT_OBJ_BLOB
,
NULL
));
cl_assert
(
git_oid_equal
(
&
a
,
&
b
)
);
cl_assert
_equal_oid
(
&
a
,
&
b
);
/* hash with invalid type */
/* hash with invalid type */
cl_git_fail
(
git_odb_hashfile
(
&
a
,
full
.
ptr
,
GIT_OBJ_ANY
));
cl_git_fail
(
git_odb_hashfile
(
&
a
,
full
.
ptr
,
GIT_OBJ_ANY
));
...
@@ -58,12 +58,12 @@ void test_repo_hashfile__filtered(void)
...
@@ -58,12 +58,12 @@ void test_repo_hashfile__filtered(void)
/* equal hashes because filter is binary */
/* equal hashes because filter is binary */
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.bin"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.bin"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.bin"
,
GIT_OBJ_BLOB
,
NULL
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.bin"
,
GIT_OBJ_BLOB
,
NULL
));
cl_assert
(
git_oid_equal
(
&
a
,
&
b
)
);
cl_assert
_equal_oid
(
&
a
,
&
b
);
/* equal hashes when 'as_file' points to binary filtering */
/* equal hashes when 'as_file' points to binary filtering */
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.txt"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.txt"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.txt"
,
GIT_OBJ_BLOB
,
"foo.bin"
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.txt"
,
GIT_OBJ_BLOB
,
"foo.bin"
));
cl_assert
(
git_oid_equal
(
&
a
,
&
b
)
);
cl_assert
_equal_oid
(
&
a
,
&
b
);
/* not equal hashes when 'as_file' points to text filtering */
/* not equal hashes when 'as_file' points to text filtering */
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.bin"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.bin"
,
GIT_OBJ_BLOB
));
...
@@ -73,11 +73,11 @@ void test_repo_hashfile__filtered(void)
...
@@ -73,11 +73,11 @@ void test_repo_hashfile__filtered(void)
/* equal hashes when 'as_file' is empty and turns off filtering */
/* equal hashes when 'as_file' is empty and turns off filtering */
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.txt"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.txt"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.txt"
,
GIT_OBJ_BLOB
,
""
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.txt"
,
GIT_OBJ_BLOB
,
""
));
cl_assert
(
git_oid_equal
(
&
a
,
&
b
)
);
cl_assert
_equal_oid
(
&
a
,
&
b
);
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.bin"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
a
,
"status/testfile.bin"
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.bin"
,
GIT_OBJ_BLOB
,
""
));
cl_git_pass
(
git_repository_hashfile
(
&
b
,
_repo
,
"testfile.bin"
,
GIT_OBJ_BLOB
,
""
));
cl_assert
(
git_oid_equal
(
&
a
,
&
b
)
);
cl_assert
_equal_oid
(
&
a
,
&
b
);
/* some hash type failures */
/* some hash type failures */
cl_git_fail
(
git_odb_hashfile
(
&
a
,
"status/testfile.txt"
,
0
));
cl_git_fail
(
git_odb_hashfile
(
&
a
,
"status/testfile.txt"
,
0
));
...
...
tests/repo/head.c
View file @
c1bf2942
...
@@ -229,13 +229,13 @@ static void test_reflog(git_repository *repo, size_t idx,
...
@@ -229,13 +229,13 @@ static void test_reflog(git_repository *repo, size_t idx,
if
(
old_spec
)
{
if
(
old_spec
)
{
git_object
*
obj
;
git_object
*
obj
;
cl_git_pass
(
git_revparse_single
(
&
obj
,
repo
,
old_spec
));
cl_git_pass
(
git_revparse_single
(
&
obj
,
repo
,
old_spec
));
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
git_object_id
(
obj
),
git_reflog_entry_id_old
(
entry
)
));
cl_assert_equal_
oid
(
git_object_id
(
obj
),
git_reflog_entry_id_old
(
entry
));
git_object_free
(
obj
);
git_object_free
(
obj
);
}
}
if
(
new_spec
)
{
if
(
new_spec
)
{
git_object
*
obj
;
git_object
*
obj
;
cl_git_pass
(
git_revparse_single
(
&
obj
,
repo
,
new_spec
));
cl_git_pass
(
git_revparse_single
(
&
obj
,
repo
,
new_spec
));
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
git_object_id
(
obj
),
git_reflog_entry_id_new
(
entry
)
));
cl_assert_equal_
oid
(
git_object_id
(
obj
),
git_reflog_entry_id_new
(
entry
));
git_object_free
(
obj
);
git_object_free
(
obj
);
}
}
...
...
tests/revwalk/hidecb.c
View file @
c1bf2942
...
@@ -69,21 +69,15 @@ static int hide_commit_cb(const git_oid *commit_id, void *data)
...
@@ -69,21 +69,15 @@ static int hide_commit_cb(const git_oid *commit_id, void *data)
GIT_UNUSED
(
commit_id
);
GIT_UNUSED
(
commit_id
);
GIT_UNUSED
(
data
);
GIT_UNUSED
(
data
);
if
(
0
==
git_oid_cmp
(
commit_id
,
&
commit_ids
[
5
]))
return
(
git_oid_cmp
(
commit_id
,
&
commit_ids
[
5
])
==
0
);
return
1
;
else
return
0
;
}
}
/* In payload data, pointer to a commit id is passed */
/* In payload data, pointer to a commit id is passed */
static
int
hide_commit_use_payload_cb
(
const
git_oid
*
commit_id
,
void
*
data
)
static
int
hide_commit_use_payload_cb
(
const
git_oid
*
commit_id
,
void
*
data
)
{
{
git_oid
*
hide_commit_id
=
data
;
git_oid
*
hide_commit_id
=
data
;
if
(
git_oid_cmp
(
commit_id
,
hide_commit_id
)
==
0
)
return
1
;
return
(
git_oid_cmp
(
commit_id
,
hide_commit_id
)
==
0
);
else
return
0
;
}
}
void
test_revwalk_hidecb__hide_all_cb
(
void
)
void
test_revwalk_hidecb__hide_all_cb
(
void
)
...
@@ -170,7 +164,7 @@ void test_revwalk_hidecb__hide_some_commits(void)
...
@@ -170,7 +164,7 @@ void test_revwalk_hidecb__hide_some_commits(void)
i
=
0
;
i
=
0
;
while
((
error
=
git_revwalk_next
(
&
id
,
walk
))
==
0
)
{
while
((
error
=
git_revwalk_next
(
&
id
,
walk
))
==
0
)
{
cl_assert_equal_
i
(
git_oid_cmp
(
&
id
,
&
commit_ids
[
i
]),
0
);
cl_assert_equal_
oid
(
&
commit_ids
[
i
],
&
id
);
i
++
;
i
++
;
}
}
...
@@ -194,7 +188,7 @@ void test_revwalk_hidecb__test_payload(void)
...
@@ -194,7 +188,7 @@ void test_revwalk_hidecb__test_payload(void)
i
=
0
;
i
=
0
;
while
((
error
=
git_revwalk_next
(
&
id
,
walk
))
==
0
)
{
while
((
error
=
git_revwalk_next
(
&
id
,
walk
))
==
0
)
{
cl_assert_equal_
i
(
git_oid_cmp
(
&
id
,
&
commit_ids
[
i
]),
0
);
cl_assert_equal_
oid
(
&
commit_ids
[
i
],
&
id
);
i
++
;
i
++
;
}
}
...
...
tests/revwalk/mergebase.c
View file @
c1bf2942
...
@@ -30,7 +30,7 @@ void test_revwalk_mergebase__single1(void)
...
@@ -30,7 +30,7 @@ void test_revwalk_mergebase__single1(void)
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"5b5b025afb0b4c913b4c338a42934a3863bf3644"
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"5b5b025afb0b4c913b4c338a42934a3863bf3644"
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_assert
(
git_oid_cmp
(
&
result
,
&
expected
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
result
);
cl_git_pass
(
git_graph_ahead_behind
(
&
ahead
,
&
behind
,
_repo
,
&
one
,
&
two
));
cl_git_pass
(
git_graph_ahead_behind
(
&
ahead
,
&
behind
,
_repo
,
&
one
,
&
two
));
cl_assert_equal_sz
(
ahead
,
2
);
cl_assert_equal_sz
(
ahead
,
2
);
...
@@ -51,7 +51,7 @@ void test_revwalk_mergebase__single2(void)
...
@@ -51,7 +51,7 @@ void test_revwalk_mergebase__single2(void)
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_assert
(
git_oid_cmp
(
&
result
,
&
expected
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
result
);
cl_git_pass
(
git_graph_ahead_behind
(
&
ahead
,
&
behind
,
_repo
,
&
one
,
&
two
));
cl_git_pass
(
git_graph_ahead_behind
(
&
ahead
,
&
behind
,
_repo
,
&
one
,
&
two
));
cl_assert_equal_sz
(
ahead
,
4
);
cl_assert_equal_sz
(
ahead
,
4
);
...
@@ -72,10 +72,10 @@ void test_revwalk_mergebase__merged_branch(void)
...
@@ -72,10 +72,10 @@ void test_revwalk_mergebase__merged_branch(void)
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"9fd738e8f7967c078dceed8190330fc8648ee56a"
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"9fd738e8f7967c078dceed8190330fc8648ee56a"
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_assert
(
git_oid_cmp
(
&
result
,
&
expected
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
result
);
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
two
,
&
one
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
two
,
&
one
));
cl_assert
(
git_oid_cmp
(
&
result
,
&
expected
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
result
);
cl_git_pass
(
git_graph_ahead_behind
(
&
ahead
,
&
behind
,
_repo
,
&
one
,
&
two
));
cl_git_pass
(
git_graph_ahead_behind
(
&
ahead
,
&
behind
,
_repo
,
&
one
,
&
two
));
cl_assert_equal_sz
(
ahead
,
0
);
cl_assert_equal_sz
(
ahead
,
0
);
...
@@ -132,7 +132,7 @@ void test_revwalk_mergebase__prefer_youngest_merge_base(void)
...
@@ -132,7 +132,7 @@ void test_revwalk_mergebase__prefer_youngest_merge_base(void)
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_git_pass
(
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
));
cl_assert
(
git_oid_cmp
(
&
result
,
&
expected
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
result
);
}
}
void
test_revwalk_mergebase__no_off_by_one_missing
(
void
)
void
test_revwalk_mergebase__no_off_by_one_missing
(
void
)
...
@@ -177,7 +177,7 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...)
...
@@ -177,7 +177,7 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...)
cl_git_pass
(
git_merge_base_many
(
&
oid
,
_repo
,
count
,
oids
));
cl_git_pass
(
git_merge_base_many
(
&
oid
,
_repo
,
count
,
oids
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
expected_sha
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
expected_sha
));
cl_assert
(
git_oid_cmp
(
&
expected
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
oid
);
}
}
git__free
(
oids
);
git__free
(
oids
);
...
@@ -241,7 +241,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...)
...
@@ -241,7 +241,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...)
cl_git_pass
(
git_merge_base_octopus
(
&
oid
,
_repo
,
count
,
oids
));
cl_git_pass
(
git_merge_base_octopus
(
&
oid
,
_repo
,
count
,
oids
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
expected_sha
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
expected_sha
));
cl_assert
(
git_oid_cmp
(
&
expected
,
&
oid
)
==
0
);
cl_assert
_equal_oid
(
&
expected
,
&
oid
);
}
}
git__free
(
oids
);
git__free
(
oids
);
...
...
tests/revwalk/simplify.c
View file @
c1bf2942
...
@@ -20,8 +20,8 @@ static const char *commit_head = "a4a7dce85cf63874e984719f4fdd239f5145052f";
...
@@ -20,8 +20,8 @@ static const char *commit_head = "a4a7dce85cf63874e984719f4fdd239f5145052f";
static
const
char
*
expected_str
[]
=
{
static
const
char
*
expected_str
[]
=
{
"a4a7dce85cf63874e984719f4fdd239f5145052f"
,
/* 0 */
"a4a7dce85cf63874e984719f4fdd239f5145052f"
,
/* 0 */
"c47800c7266a2be04c571c04d5a6614691ea99bd"
,
/* 3 */
"c47800c7266a2be04c571c04d5a6614691ea99bd"
,
/* 3 */
"
8496071c1b46c854b31185ea97743be6a8774479
"
,
/* 4 */
"
5b5b025afb0b4c913b4c338a42934a3863bf3644
"
,
/* 4 */
"
5b5b025afb0b4c913b4c338a42934a3863bf3644
"
,
/* 5 */
"
8496071c1b46c854b31185ea97743be6a8774479
"
,
/* 5 */
};
};
void
test_revwalk_simplify__first_parent
(
void
)
void
test_revwalk_simplify__first_parent
(
void
)
...
@@ -44,7 +44,7 @@ void test_revwalk_simplify__first_parent(void)
...
@@ -44,7 +44,7 @@ void test_revwalk_simplify__first_parent(void)
i
=
0
;
i
=
0
;
while
((
error
=
git_revwalk_next
(
&
id
,
walk
))
==
0
)
{
while
((
error
=
git_revwalk_next
(
&
id
,
walk
))
==
0
)
{
git_oid_cmp
(
&
id
,
&
expected
[
i
]
);
cl_assert_equal_oid
(
&
expected
[
i
],
&
id
);
i
++
;
i
++
;
}
}
...
...
tests/stash/drop.c
View file @
c1bf2942
...
@@ -115,7 +115,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
...
@@ -115,7 +115,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
cl_git_pass
(
git_reflog_read
(
&
reflog
,
repo
,
GIT_REFS_STASH_FILE
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
repo
,
GIT_REFS_STASH_FILE
));
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
cl_assert_equal_
i
(
0
,
git_oid_cmp
(
&
oid
,
git_reflog_entry_id_old
(
entry
)
));
cl_assert_equal_
oid
(
&
oid
,
git_reflog_entry_id_old
(
entry
));
cl_assert_equal_sz
(
count
-
1
,
git_reflog_entrycount
(
reflog
));
cl_assert_equal_sz
(
count
-
1
,
git_reflog_entrycount
(
reflog
));
git_reflog_free
(
reflog
);
git_reflog_free
(
reflog
);
...
@@ -147,7 +147,7 @@ void retrieve_top_stash_id(git_oid *out)
...
@@ -147,7 +147,7 @@ void retrieve_top_stash_id(git_oid *out)
cl_git_pass
(
git_revparse_single
(
&
top_stash
,
repo
,
"stash@{0}"
));
cl_git_pass
(
git_revparse_single
(
&
top_stash
,
repo
,
"stash@{0}"
));
cl_git_pass
(
git_reference_name_to_id
(
out
,
repo
,
GIT_REFS_STASH_FILE
));
cl_git_pass
(
git_reference_name_to_id
(
out
,
repo
,
GIT_REFS_STASH_FILE
));
cl_assert_equal_
i
(
true
,
git_oid_cmp
(
out
,
git_object_id
(
top_stash
))
==
0
);
cl_assert_equal_
oid
(
out
,
git_object_id
(
top_stash
)
);
git_object_free
(
top_stash
);
git_object_free
(
top_stash
);
}
}
...
@@ -162,13 +162,13 @@ void test_stash_drop__dropping_the_top_stash_updates_the_stash_reference(void)
...
@@ -162,13 +162,13 @@ void test_stash_drop__dropping_the_top_stash_updates_the_stash_reference(void)
retrieve_top_stash_id
(
&
oid
);
retrieve_top_stash_id
(
&
oid
);
cl_git_pass
(
git_revparse_single
(
&
next_top_stash
,
repo
,
"stash@{1}"
));
cl_git_pass
(
git_revparse_single
(
&
next_top_stash
,
repo
,
"stash@{1}"
));
cl_assert
(
git_oid_cmp
(
&
oid
,
git_object_id
(
next_top_stash
))
!=
0
);
cl_assert
(
git_oid_cmp
(
&
oid
,
git_object_id
(
next_top_stash
)));
cl_git_pass
(
git_stash_drop
(
repo
,
0
));
cl_git_pass
(
git_stash_drop
(
repo
,
0
));
retrieve_top_stash_id
(
&
oid
);
retrieve_top_stash_id
(
&
oid
);
cl_
git_pass
(
git_oid_cmp
(
&
oid
,
git_object_id
(
next_top_stash
)
));
cl_
assert_equal_oid
(
&
oid
,
git_object_id
(
next_top_stash
));
git_object_free
(
next_top_stash
);
git_object_free
(
next_top_stash
);
}
}
tests/status/single.c
View file @
c1bf2942
...
@@ -22,7 +22,7 @@ void test_status_single__hash_single_file(void)
...
@@ -22,7 +22,7 @@ void test_status_single__hash_single_file(void)
cl_set_cleanup
(
&
cleanup__remove_file
,
(
void
*
)
file_name
);
cl_set_cleanup
(
&
cleanup__remove_file
,
(
void
*
)
file_name
);
cl_git_pass
(
git_odb_hashfile
(
&
actual_id
,
file_name
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
actual_id
,
file_name
,
GIT_OBJ_BLOB
));
cl_assert
(
git_oid_cmp
(
&
expected_id
,
&
actual_id
)
==
0
);
cl_assert
_equal_oid
(
&
expected_id
,
&
actual_id
);
}
}
/* test retrieving OID from an empty file apart from the ODB */
/* test retrieving OID from an empty file apart from the ODB */
...
@@ -40,6 +40,6 @@ void test_status_single__hash_single_empty_file(void)
...
@@ -40,6 +40,6 @@ void test_status_single__hash_single_empty_file(void)
cl_set_cleanup
(
&
cleanup__remove_file
,
(
void
*
)
file_name
);
cl_set_cleanup
(
&
cleanup__remove_file
,
(
void
*
)
file_name
);
cl_git_pass
(
git_odb_hashfile
(
&
actual_id
,
file_name
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_odb_hashfile
(
&
actual_id
,
file_name
,
GIT_OBJ_BLOB
));
cl_assert
(
git_oid_cmp
(
&
expected_id
,
&
actual_id
)
==
0
);
cl_assert
_equal_oid
(
&
expected_id
,
&
actual_id
);
}
}
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