summaryrefslogtreecommitdiff
path: root/tests/remote/fetch.c
diff options
context:
space:
mode:
authorAlex Good <alex@memoryandthought.me>2021-07-08 11:58:28 +0100
committerAlex Good <alex@memoryandthought.me>2021-08-05 12:42:37 +0100
commita5696702dbd8c7abbd37f083a411adecab7cedfe (patch)
treea946a6be88502182a96fb9a48d8cac0ef019ceb5 /tests/remote/fetch.c
parent39fd7646cbb7cdc41c4f6810ca69ed234307fe10 (diff)
downloadlibgit2-a5696702dbd8c7abbd37f083a411adecab7cedfe.tar.gz
skip descendant check if remote ref not found
Diffstat (limited to 'tests/remote/fetch.c')
-rw-r--r--tests/remote/fetch.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/remote/fetch.c b/tests/remote/fetch.c
index 8a61a2672..392801e0b 100644
--- a/tests/remote/fetch.c
+++ b/tests/remote/fetch.c
@@ -13,33 +13,18 @@ static const char *REPO2_REFNAME = "refs/remotes/repo1/main";
static char *FORCE_FETCHSPEC = "+refs/heads/main:refs/remotes/repo1/main";
static char *NON_FORCE_FETCHSPEC = "refs/heads/main:refs/remotes/repo1/main";
-char* strip_trailing_slash(char *path) {
- if (path[strlen(path) - 1] == '/') {
- char* result = (char *) calloc(strlen(path) - 1, sizeof(char));
- memcpy(result, path, strlen(path) - 1);
- return result;
- } else {
- char* result = (char *) calloc(strlen(path), sizeof(char));
- strncpy(result, path, strlen(path));
- return result;
- }
-}
-
-
void test_remote_fetch__initialize(void) {
git_config *c;
git_buf repo1_path_buf = GIT_BUF_INIT;
git_buf repo2_path_buf = GIT_BUF_INIT;
const char *sandbox = clar_sandbox_path();
- cl_git_pass(git_buf_join(&repo1_path_buf, '/', sandbox, "fetchtest_repo1"));
- repo1_path = calloc(repo1_path_buf.size, sizeof(char));
- git_buf_copy_cstr(repo1_path, repo1_path_buf.size, &repo1_path_buf);
+ cl_git_pass(git_buf_joinpath(&repo1_path_buf, sandbox, "fetchtest_repo1"));
+ repo1_path = git_buf_detach(&repo1_path_buf);
cl_git_pass(git_repository_init(&repo1, repo1_path, true));
- cl_git_pass(git_buf_join(&repo2_path_buf, '/', sandbox, "fetchtest_repo2"));
- repo2_path = calloc(repo2_path_buf.size, sizeof(char));
- git_buf_copy_cstr(repo2_path, repo2_path_buf.size, &repo2_path_buf);
+ cl_git_pass(git_buf_joinpath(&repo2_path_buf, sandbox, "fetchtest_repo2"));
+ repo2_path = git_buf_detach(&repo2_path_buf);
cl_git_pass(git_repository_init(&repo2, repo2_path, true));
cl_git_pass(git_repository_config(&c, repo1));