diff options
author | Ben Straub <bs@github.com> | 2013-04-15 23:00:04 +0400 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-04-15 23:00:04 +0400 |
commit | 299a224be16368dc36bef4dc3f5e711ce35300cd (patch) | |
tree | 5371b54270c4b84abd586c49d7eb06b80d3d4e7b /tests-clar/refs | |
parent | 2ebc3c66c292539786b6ec1538f740c5e444fe16 (diff) |
Change git_revparse to output git_object pointers
This will probably prevent many lookup/free
operations in calling code.
Diffstat (limited to 'tests-clar/refs')
-rw-r--r-- | tests-clar/refs/revparse.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c index 8c3e5e43a..c1cfc58af 100644 --- a/tests-clar/refs/revparse.c +++ b/tests-clar/refs/revparse.c @@ -34,7 +34,7 @@ static void test_id_inrepo( git_revparse_flag_t expected_flags, git_repository *repo) { - git_oid l = {{0}}, r = {{0}}; + git_object *l, *r; git_revparse_flag_t flags = 0; int error = git_revparse(&l, &r, &flags, repo, spec); @@ -42,16 +42,18 @@ static void test_id_inrepo( if (expected_left) { char str[64] = {0}; cl_assert_equal_i(0, error); - git_oid_fmt(str, &l); + git_oid_fmt(str, git_object_id(l)); cl_assert_equal_s(str, expected_left); + git_object_free(l); } else { cl_assert_equal_i(GIT_ENOTFOUND, error); } if (expected_right) { char str[64] = {0}; - git_oid_fmt(str, &r); + git_oid_fmt(str, git_object_id(r)); cl_assert_equal_s(str, expected_right); + git_object_free(r); } if (expected_flags) @@ -69,7 +71,7 @@ static void test_rangelike(const char *rangelike, git_revparse_flag_t expected_revparseflags) { char objstr[64] = {0}; - git_oid left = {{0}}, right = {{0}}; + git_object *left = NULL, *right = NULL; git_revparse_flag_t revparseflags; int error; @@ -78,12 +80,15 @@ static void test_rangelike(const char *rangelike, if (expected_left != NULL) { cl_assert_equal_i(0, error); cl_assert_equal_i(revparseflags, expected_revparseflags); - git_oid_fmt(objstr, &left); + git_oid_fmt(objstr, git_object_id(left)); cl_assert_equal_s(objstr, expected_left); - git_oid_fmt(objstr, &right); + git_oid_fmt(objstr, git_object_id(right)); cl_assert_equal_s(objstr, expected_right); } else cl_assert(error != 0); + + git_object_free(left); + git_object_free(right); } @@ -681,7 +686,7 @@ void test_refs_revparse__range(void) void test_refs_revparse__validates_args(void) { - git_oid l={{0}}, r={{0}}; + git_object *l, *r; git_revparse_flag_t flags = 0; cl_git_pass(git_revparse(&l,&r,NULL, g_repo, "HEAD")); |