diff options
author | Vicent Marti <vicent@github.com> | 2014-08-18 15:18:59 +0200 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-08-18 15:18:59 +0200 |
commit | d28b2b7a5ff608ce8f3da0e0b6a4c75afcf1e82c (patch) | |
tree | b060de361e87763abd373bc535fcb09778c28e29 /tests | |
parent | 43ebca8d7baa420a35ac1a8b23258066a0e5b223 (diff) | |
parent | 4ca0b566ca811550b4db31045e580b4970e5b8e3 (diff) | |
download | libgit2-d28b2b7a5ff608ce8f3da0e0b6a4c75afcf1e82c.tar.gz |
Merge pull request #2528 from libgit2/vmg/tostr_s
Export `git_oid_tostr_s` instead of `_allocfmt`
Diffstat (limited to 'tests')
-rw-r--r-- | tests/object/raw/compare.c | 5 | ||||
-rw-r--r-- | tests/online/push_util.c | 6 | ||||
-rw-r--r-- | tests/stash/save.c | 8 |
3 files changed, 5 insertions, 14 deletions
diff --git a/tests/object/raw/compare.c b/tests/object/raw/compare.c index 1c9ce4b81..56c016b72 100644 --- a/tests/object/raw/compare.c +++ b/tests/object/raw/compare.c @@ -90,7 +90,7 @@ void test_object_raw_compare__compare_fmt_oids(void) cl_assert_equal_s(exp, out); } -void test_object_raw_compare__compare_allocfmt_oids(void) +void test_object_raw_compare__compare_static_oids(void) { const char *exp = "16a0123456789abcdef4b775213c23a8bd74f5e0"; git_oid in; @@ -98,10 +98,9 @@ void test_object_raw_compare__compare_allocfmt_oids(void) cl_git_pass(git_oid_fromstr(&in, exp)); - out = git_oid_allocfmt(&in); + out = git_oid_tostr_s(&in); cl_assert(out); cl_assert_equal_s(exp, out); - git__free(out); } void test_object_raw_compare__compare_pathfmt_oids(void) diff --git a/tests/online/push_util.c b/tests/online/push_util.c index 038c144db..68e71eacc 100644 --- a/tests/online/push_util.c +++ b/tests/online/push_util.c @@ -110,9 +110,8 @@ failed: git_buf_puts(&msg, "Expected and actual refs differ:\nEXPECTED:\n"); for(i = 0; i < expected_refs_len; i++) { - cl_assert(oid_str = git_oid_allocfmt(expected_refs[i].oid)); + oid_str = git_oid_tostr_s(expected_refs[i].oid); cl_git_pass(git_buf_printf(&msg, "%s = %s\n", expected_refs[i].name, oid_str)); - git__free(oid_str); } git_buf_puts(&msg, "\nACTUAL:\n"); @@ -121,9 +120,8 @@ failed: if (master_present && !strcmp(actual->name, "refs/heads/master")) continue; - cl_assert(oid_str = git_oid_allocfmt(&actual->oid)); + oid_str = git_oid_tostr_s(&actual->oid); cl_git_pass(git_buf_printf(&msg, "%s = %s\n", actual->name, oid_str)); - git__free(oid_str); } cl_fail(git_buf_cstr(&msg)); diff --git a/tests/stash/save.c b/tests/stash/save.c index 87c6d7e0f..3b301bfc0 100644 --- a/tests/stash/save.c +++ b/tests/stash/save.c @@ -227,18 +227,12 @@ void test_stash_save__can_stash_against_a_detached_head(void) void test_stash_save__stashing_updates_the_reflog(void) { - char *sha; - assert_object_oid("refs/stash@{0}", NULL, GIT_OBJ_COMMIT); cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT)); - sha = git_oid_allocfmt(&stash_tip_oid); - - assert_object_oid("refs/stash@{0}", sha, GIT_OBJ_COMMIT); + assert_object_oid("refs/stash@{0}", git_oid_tostr_s(&stash_tip_oid), GIT_OBJ_COMMIT); assert_object_oid("refs/stash@{1}", NULL, GIT_OBJ_COMMIT); - - git__free(sha); } void test_stash_save__cannot_stash_when_there_are_no_local_change(void) |