summaryrefslogtreecommitdiff
path: root/tests/clone/empty.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-01-26 16:03:37 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-01-27 04:44:05 +0100
commitb25d87c9cdef0bc09007c756d7e52f15eb4622d7 (patch)
tree6f95b302cac224f89739b223a14e3ec00da23731 /tests/clone/empty.c
parent7a3bd1e73215f8939f270092e0673d6c0f3f32af (diff)
downloadlibgit2-b25d87c9cdef0bc09007c756d7e52f15eb4622d7.tar.gz
branch: move to git_buf when outputting newly-allocated strings
Internally we already did everything with git_bufs, so this is just exposing those functions with public names.
Diffstat (limited to 'tests/clone/empty.c')
-rw-r--r--tests/clone/empty.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/clone/empty.c b/tests/clone/empty.c
index 6d19244cc..78aef7dae 100644
--- a/tests/clone/empty.c
+++ b/tests/clone/empty.c
@@ -38,7 +38,7 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
char *local_name = "refs/heads/master";
const char *expected_tracked_branch_name = "refs/remotes/origin/master";
const char *expected_remote_name = "origin";
- char buffer[1024];
+ git_buf buf = GIT_BUF_INIT;
git_reference *ref;
cl_set_cleanup(&cleanup_repository, "./empty");
@@ -50,16 +50,14 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&ref, g_repo_cloned, local_name));
/* ...one can still retrieve the name of the remote tracking reference */
- cl_assert_equal_i((int)strlen(expected_tracked_branch_name) + 1,
- git_branch_upstream_name(buffer, 1024, g_repo_cloned, local_name));
+ cl_git_pass(git_branch_upstream_name(&buf, g_repo_cloned, local_name));
- cl_assert_equal_s(expected_tracked_branch_name, buffer);
+ cl_assert_equal_s(expected_tracked_branch_name, buf.ptr);
/* ...and the name of the remote... */
- cl_assert_equal_i((int)strlen(expected_remote_name) + 1,
- git_branch_remote_name(buffer, 1024, g_repo_cloned, expected_tracked_branch_name));
+ cl_git_pass(git_branch_remote_name(&buf, g_repo_cloned, expected_tracked_branch_name));
- cl_assert_equal_s(expected_remote_name, buffer);
+ cl_assert_equal_s(expected_remote_name, buf.ptr);
/* ...even when the remote HEAD is unborn as well */
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&ref, g_repo_cloned,