summaryrefslogtreecommitdiff
path: root/tests/checkout
diff options
context:
space:
mode:
Diffstat (limited to 'tests/checkout')
-rw-r--r--tests/checkout/checkout_helpers.c6
-rw-r--r--tests/checkout/checkout_helpers.h1
-rw-r--r--tests/checkout/conflict.c38
-rw-r--r--tests/checkout/crlf.c84
-rw-r--r--tests/checkout/icase.c8
-rw-r--r--tests/checkout/index.c18
-rw-r--r--tests/checkout/nasty.c13
-rw-r--r--tests/checkout/tree.c23
-rw-r--r--tests/checkout/typechange.c22
9 files changed, 105 insertions, 108 deletions
diff --git a/tests/checkout/checkout_helpers.c b/tests/checkout/checkout_helpers.c
index 95af5d396..1e9c21bdc 100644
--- a/tests/checkout/checkout_helpers.c
+++ b/tests/checkout/checkout_helpers.c
@@ -7,16 +7,16 @@
void assert_on_branch(git_repository *repo, const char *branch)
{
git_reference *head;
- git_buf bname = GIT_BUF_INIT;
+ git_str bname = GIT_STR_INIT;
cl_git_pass(git_reference_lookup(&head, repo, GIT_HEAD_FILE));
cl_assert_(git_reference_type(head) == GIT_REFERENCE_SYMBOLIC, branch);
- cl_git_pass(git_buf_joinpath(&bname, "refs/heads", branch));
+ cl_git_pass(git_str_joinpath(&bname, "refs/heads", branch));
cl_assert_equal_s(bname.ptr, git_reference_symbolic_target(head));
git_reference_free(head);
- git_buf_dispose(&bname);
+ git_str_dispose(&bname);
}
void reset_index_to_treeish(git_object *treeish)
diff --git a/tests/checkout/checkout_helpers.h b/tests/checkout/checkout_helpers.h
index 6058a196c..879b48b06 100644
--- a/tests/checkout/checkout_helpers.h
+++ b/tests/checkout/checkout_helpers.h
@@ -1,4 +1,3 @@
-#include "buffer.h"
#include "git2/object.h"
#include "git2/repository.h"
diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c
index dae3f295e..3f5e7162d 100644
--- a/tests/checkout/conflict.c
+++ b/tests/checkout/conflict.c
@@ -85,14 +85,14 @@ void test_checkout_conflict__cleanup(void)
static void create_index(struct checkout_index_entry *entries, size_t entries_len)
{
- git_buf path = GIT_BUF_INIT;
+ git_str path = GIT_STR_INIT;
size_t i;
for (i = 0; i < entries_len; i++) {
- git_buf_joinpath(&path, TEST_REPO_PATH, entries[i].path);
+ git_str_joinpath(&path, TEST_REPO_PATH, entries[i].path);
if (entries[i].stage == 3 && (i == 0 || strcmp(entries[i-1].path, entries[i].path) != 0 || entries[i-1].stage != 2))
- p_unlink(git_buf_cstr(&path));
+ p_unlink(git_str_cstr(&path));
cl_git_pass(git_index_remove_bypath(g_index, entries[i].path));
}
@@ -110,7 +110,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
cl_git_pass(git_index_add(g_index, &entry));
}
- git_buf_dispose(&path);
+ git_str_dispose(&path);
}
static void create_index_names(struct checkout_name_entry *entries, size_t entries_len)
@@ -139,16 +139,16 @@ static void create_conflicting_index(void)
static void ensure_workdir_contents(const char *path, const char *contents)
{
- git_buf fullpath = GIT_BUF_INIT, data_buf = GIT_BUF_INIT;
+ git_str fullpath = GIT_STR_INIT, data_buf = GIT_STR_INIT;
cl_git_pass(
- git_buf_joinpath(&fullpath, git_repository_workdir(g_repo), path));
+ git_str_joinpath(&fullpath, git_repository_workdir(g_repo), path));
- cl_git_pass(git_futils_readbuffer(&data_buf, git_buf_cstr(&fullpath)));
- cl_assert(strcmp(git_buf_cstr(&data_buf), contents) == 0);
+ cl_git_pass(git_futils_readbuffer(&data_buf, git_str_cstr(&fullpath)));
+ cl_assert(strcmp(git_str_cstr(&data_buf), contents) == 0);
- git_buf_dispose(&fullpath);
- git_buf_dispose(&data_buf);
+ git_str_dispose(&fullpath);
+ git_str_dispose(&data_buf);
}
static void ensure_workdir_oid(const char *path, const char *oid_str)
@@ -166,16 +166,16 @@ static void ensure_workdir_mode(const char *path, int mode)
GIT_UNUSED(path);
GIT_UNUSED(mode);
#else
- git_buf fullpath = GIT_BUF_INIT;
+ git_str fullpath = GIT_STR_INIT;
struct stat st;
cl_git_pass(
- git_buf_joinpath(&fullpath, git_repository_workdir(g_repo), path));
+ git_str_joinpath(&fullpath, git_repository_workdir(g_repo), path));
- cl_git_pass(p_stat(git_buf_cstr(&fullpath), &st));
+ cl_git_pass(p_stat(git_str_cstr(&fullpath), &st));
cl_assert_equal_i((mode & S_IRWXU), (st.st_mode & S_IRWXU));
- git_buf_dispose(&fullpath);
+ git_str_dispose(&fullpath);
#endif
}
@@ -197,22 +197,22 @@ static void ensure_workdir_link(
if (!symlinks) {
ensure_workdir_contents(path, target);
} else {
- git_buf fullpath = GIT_BUF_INIT;
+ git_str fullpath = GIT_STR_INIT;
char actual[1024];
struct stat st;
int len;
cl_git_pass(
- git_buf_joinpath(&fullpath, git_repository_workdir(g_repo), path));
+ git_str_joinpath(&fullpath, git_repository_workdir(g_repo), path));
- cl_git_pass(p_lstat(git_buf_cstr(&fullpath), &st));
+ cl_git_pass(p_lstat(git_str_cstr(&fullpath), &st));
cl_assert(S_ISLNK(st.st_mode));
- cl_assert((len = p_readlink(git_buf_cstr(&fullpath), actual, 1024)) > 0);
+ cl_assert((len = p_readlink(git_str_cstr(&fullpath), actual, 1024)) > 0);
actual[len] = '\0';
cl_assert(strcmp(actual, target) == 0);
- git_buf_dispose(&fullpath);
+ git_str_dispose(&fullpath);
}
}
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c
index 495020161..eb4c61f39 100644
--- a/tests/checkout/crlf.c
+++ b/tests/checkout/crlf.c
@@ -11,9 +11,9 @@
static git_repository *g_repo;
static const char *systype;
-static git_buf expected_fixture = GIT_BUF_INIT;
+static git_str expected_fixture = GIT_STR_INIT;
-static int unlink_file(void *payload, git_buf *path)
+static int unlink_file(void *payload, git_str *path)
{
char *fn;
@@ -30,7 +30,7 @@ static int unlink_file(void *payload, git_buf *path)
void test_checkout_crlf__initialize(void)
{
- git_buf reponame = GIT_BUF_INIT;
+ git_str reponame = GIT_STR_INIT;
g_repo = cl_git_sandbox_init("crlf");
@@ -38,7 +38,7 @@ void test_checkout_crlf__initialize(void)
* remove the contents of the working directory so that we can
* check out over it.
*/
- cl_git_pass(git_buf_puts(&reponame, "crlf"));
+ cl_git_pass(git_str_puts(&reponame, "crlf"));
cl_git_pass(git_path_direach(&reponame, 0, unlink_file, NULL));
if (GIT_EOL_NATIVE == GIT_EOL_CRLF)
@@ -46,7 +46,7 @@ void test_checkout_crlf__initialize(void)
else
systype = "posix";
- git_buf_dispose(&reponame);
+ git_str_dispose(&reponame);
}
void test_checkout_crlf__cleanup(void)
@@ -55,7 +55,7 @@ void test_checkout_crlf__cleanup(void)
if (expected_fixture.size) {
cl_fixture_cleanup(expected_fixture.ptr);
- git_buf_dispose(&expected_fixture);
+ git_str_dispose(&expected_fixture);
}
}
@@ -66,11 +66,11 @@ struct compare_data
const char *attrs;
};
-static int compare_file(void *payload, git_buf *actual_path)
+static int compare_file(void *payload, git_str *actual_path)
{
- git_buf expected_path = GIT_BUF_INIT;
- git_buf actual_contents = GIT_BUF_INIT;
- git_buf expected_contents = GIT_BUF_INIT;
+ git_str expected_path = GIT_STR_INIT;
+ git_str actual_contents = GIT_STR_INIT;
+ git_str expected_contents = GIT_STR_INIT;
struct compare_data *cd = payload;
bool failed = true;
int cmp_git, cmp_gitattributes;
@@ -85,7 +85,7 @@ static int compare_file(void *payload, git_buf *actual_path)
goto done;
}
- cl_git_pass(git_buf_joinpath(&expected_path, cd->dirname, basename));
+ cl_git_pass(git_str_joinpath(&expected_path, cd->dirname, basename));
if (!git_path_isfile(expected_path.ptr) ||
!git_path_isfile(actual_path->ptr))
@@ -105,61 +105,61 @@ static int compare_file(void *payload, git_buf *actual_path)
done:
if (failed) {
- git_buf details = GIT_BUF_INIT;
- git_buf_printf(&details, "filename=%s, system=%s, autocrlf=%s, attrs={%s}",
+ git_str details = GIT_STR_INIT;
+ git_str_printf(&details, "filename=%s, system=%s, autocrlf=%s, attrs={%s}",
git_path_basename(actual_path->ptr), systype, cd->autocrlf, cd->attrs);
clar__fail(__FILE__, __func__, __LINE__,
"checked out contents did not match expected", details.ptr, 0);
- git_buf_dispose(&details);
+ git_str_dispose(&details);
}
git__free(basename);
- git_buf_dispose(&expected_contents);
- git_buf_dispose(&actual_contents);
- git_buf_dispose(&expected_path);
+ git_str_dispose(&expected_contents);
+ git_str_dispose(&actual_contents);
+ git_str_dispose(&expected_path);
return 0;
}
static void test_checkout(const char *autocrlf, const char *attrs)
{
- git_buf attrbuf = GIT_BUF_INIT;
- git_buf expected_dirname = GIT_BUF_INIT;
- git_buf systype_and_direction = GIT_BUF_INIT;
- git_buf sandboxname = GIT_BUF_INIT;
- git_buf reponame = GIT_BUF_INIT;
+ git_str attrbuf = GIT_STR_INIT;
+ git_str expected_dirname = GIT_STR_INIT;
+ git_str systype_and_direction = GIT_STR_INIT;
+ git_str sandboxname = GIT_STR_INIT;
+ git_str reponame = GIT_STR_INIT;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
struct compare_data compare_data = { NULL, autocrlf, attrs };
const char *c;
- cl_git_pass(git_buf_puts(&reponame, "crlf"));
+ cl_git_pass(git_str_puts(&reponame, "crlf"));
- cl_git_pass(git_buf_puts(&systype_and_direction, systype));
- cl_git_pass(git_buf_puts(&systype_and_direction, "_to_workdir"));
+ cl_git_pass(git_str_puts(&systype_and_direction, systype));
+ cl_git_pass(git_str_puts(&systype_and_direction, "_to_workdir"));
- cl_git_pass(git_buf_puts(&sandboxname, "autocrlf_"));
- cl_git_pass(git_buf_puts(&sandboxname, autocrlf));
+ cl_git_pass(git_str_puts(&sandboxname, "autocrlf_"));
+ cl_git_pass(git_str_puts(&sandboxname, autocrlf));
if (*attrs) {
- cl_git_pass(git_buf_puts(&sandboxname, ","));
+ cl_git_pass(git_str_puts(&sandboxname, ","));
for (c = attrs; *c; c++) {
if (*c == ' ')
- cl_git_pass(git_buf_putc(&sandboxname, ','));
+ cl_git_pass(git_str_putc(&sandboxname, ','));
else if (*c == '=')
- cl_git_pass(git_buf_putc(&sandboxname, '_'));
+ cl_git_pass(git_str_putc(&sandboxname, '_'));
else
- cl_git_pass(git_buf_putc(&sandboxname, *c));
+ cl_git_pass(git_str_putc(&sandboxname, *c));
}
- cl_git_pass(git_buf_printf(&attrbuf, "* %s\n", attrs));
+ cl_git_pass(git_str_printf(&attrbuf, "* %s\n", attrs));
cl_git_mkfile("crlf/.gitattributes", attrbuf.ptr);
}
cl_repo_set_string(g_repo, "core.autocrlf", autocrlf);
- cl_git_pass(git_buf_joinpath(&expected_dirname, systype_and_direction.ptr, sandboxname.ptr));
- cl_git_pass(git_buf_joinpath(&expected_fixture, "crlf_data", expected_dirname.ptr));
+ cl_git_pass(git_str_joinpath(&expected_dirname, systype_and_direction.ptr, sandboxname.ptr));
+ cl_git_pass(git_str_joinpath(&expected_fixture, "crlf_data", expected_dirname.ptr));
cl_fixture_sandbox(expected_fixture.ptr);
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
@@ -169,14 +169,14 @@ static void test_checkout(const char *autocrlf, const char *attrs)
cl_git_pass(git_path_direach(&reponame, 0, compare_file, &compare_data));
cl_fixture_cleanup(expected_fixture.ptr);
- git_buf_dispose(&expected_fixture);
-
- git_buf_dispose(&attrbuf);
- git_buf_dispose(&expected_fixture);
- git_buf_dispose(&expected_dirname);
- git_buf_dispose(&sandboxname);
- git_buf_dispose(&systype_and_direction);
- git_buf_dispose(&reponame);
+ git_str_dispose(&expected_fixture);
+
+ git_str_dispose(&attrbuf);
+ git_str_dispose(&expected_fixture);
+ git_str_dispose(&expected_dirname);
+ git_str_dispose(&sandboxname);
+ git_str_dispose(&systype_and_direction);
+ git_str_dispose(&reponame);
}
static void empty_workdir(const char *name)
diff --git a/tests/checkout/icase.c b/tests/checkout/icase.c
index 077d24cd3..6c30765a3 100644
--- a/tests/checkout/icase.c
+++ b/tests/checkout/icase.c
@@ -46,7 +46,7 @@ void test_checkout_icase__cleanup(void)
static char *get_filename(const char *in)
{
char *search_dirname, *search_filename, *filename = NULL;
- git_buf out = GIT_BUF_INIT;
+ git_str out = GIT_STR_INIT;
DIR *dir;
struct dirent *de;
@@ -57,8 +57,8 @@ static char *get_filename(const char *in)
while ((de = readdir(dir))) {
if (strcasecmp(de->d_name, search_filename) == 0) {
- git_buf_join(&out, '/', search_dirname, de->d_name);
- filename = git_buf_detach(&out);
+ git_str_join(&out, '/', search_dirname, de->d_name);
+ filename = git_str_detach(&out);
break;
}
}
@@ -67,7 +67,7 @@ static char *get_filename(const char *in)
git__free(search_dirname);
git__free(search_filename);
- git_buf_dispose(&out);
+ git_str_dispose(&out);
return filename;
}
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index 508975365..13eecc984 100644
--- a/tests/checkout/index.c
+++ b/tests/checkout/index.c
@@ -8,7 +8,7 @@
#include "repo/repo_helpers.h"
static git_repository *g_repo;
-static git_buf g_global_path = GIT_BUF_INIT;
+static git_str g_global_path = GIT_STR_INIT;
void test_checkout_index__initialize(void)
{
@@ -33,7 +33,7 @@ void test_checkout_index__cleanup(void)
{
git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL,
g_global_path.ptr);
- git_buf_dispose(&g_global_path);
+ git_str_dispose(&g_global_path);
cl_git_sandbox_cleanup();
@@ -203,14 +203,14 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
static void populate_symlink_workdir(void)
{
- git_buf path = GIT_BUF_INIT;
+ git_str path = GIT_STR_INIT;
git_repository *repo;
git_remote *origin;
git_object *target;
const char *url = git_repository_path(g_repo);
- cl_git_pass(git_buf_joinpath(&path, clar_sandbox_path(), "symlink.git"));
+ cl_git_pass(git_str_joinpath(&path, clar_sandbox_path(), "symlink.git"));
cl_git_pass(git_repository_init(&repo, path.ptr, true));
cl_git_pass(git_repository_set_workdir(repo, "symlink", 1));
@@ -226,7 +226,7 @@ static void populate_symlink_workdir(void)
git_object_free(target);
git_repository_free(repo);
- git_buf_dispose(&path);
+ git_str_dispose(&path);
}
void test_checkout_index__honor_coresymlinks_default_true(void)
@@ -808,7 +808,7 @@ void test_checkout_index__writes_conflict_file(void)
{
git_index *index;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- git_buf conflicting_buf = GIT_BUF_INIT;
+ git_str conflicting_buf = GIT_STR_INIT;
cl_git_pass(git_repository_index(&index, g_repo));
@@ -824,7 +824,7 @@ void test_checkout_index__writes_conflict_file(void)
"=======\n"
"this file is changed in branch and master\n"
">>>>>>> theirs\n") == 0);
- git_buf_dispose(&conflicting_buf);
+ git_str_dispose(&conflicting_buf);
git_index_free(index);
}
@@ -855,7 +855,7 @@ void test_checkout_index__conflicts_honor_coreautocrlf(void)
#ifdef GIT_WIN32
git_index *index;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- git_buf conflicting_buf = GIT_BUF_INIT;
+ git_str conflicting_buf = GIT_STR_INIT;
cl_git_pass(p_unlink("./testrepo/.gitattributes"));
cl_repo_set_bool(g_repo, "core.autocrlf", true);
@@ -874,7 +874,7 @@ void test_checkout_index__conflicts_honor_coreautocrlf(void)
"=======\r\n"
"this file is changed in branch and master\r\n"
">>>>>>> theirs\r\n") == 0);
- git_buf_dispose(&conflicting_buf);
+ git_str_dispose(&conflicting_buf);
git_index_free(index);
#endif
diff --git a/tests/checkout/nasty.c b/tests/checkout/nasty.c
index 611e850d3..a1b3164be 100644
--- a/tests/checkout/nasty.c
+++ b/tests/checkout/nasty.c
@@ -3,7 +3,6 @@
#include "git2/checkout.h"
#include "repository.h"
-#include "buffer.h"
#include "futils.h"
static const char *repo_name = "nasty";
@@ -28,9 +27,9 @@ static void test_checkout_passes(const char *refname, const char *filename)
git_oid commit_id;
git_commit *commit;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- git_buf path = GIT_BUF_INIT;
+ git_str path = GIT_STR_INIT;
- cl_git_pass(git_buf_joinpath(&path, repo_name, filename));
+ cl_git_pass(git_str_joinpath(&path, repo_name, filename));
cl_git_pass(git_reference_name_to_id(&commit_id, repo, refname));
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
@@ -42,7 +41,7 @@ static void test_checkout_passes(const char *refname, const char *filename)
cl_assert(!git_path_exists(path.ptr));
git_commit_free(commit);
- git_buf_dispose(&path);
+ git_str_dispose(&path);
}
static void test_checkout_fails(const char *refname, const char *filename)
@@ -50,9 +49,9 @@ static void test_checkout_fails(const char *refname, const char *filename)
git_oid commit_id;
git_commit *commit;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
- git_buf path = GIT_BUF_INIT;
+ git_str path = GIT_STR_INIT;
- cl_git_pass(git_buf_joinpath(&path, repo_name, filename));
+ cl_git_pass(git_str_joinpath(&path, repo_name, filename));
cl_git_pass(git_reference_name_to_id(&commit_id, repo, refname));
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
@@ -63,7 +62,7 @@ static void test_checkout_fails(const char *refname, const char *filename)
cl_assert(!git_path_exists(path.ptr));
git_commit_free(commit);
- git_buf_dispose(&path);
+ git_str_dispose(&path);
}
/* A tree that contains ".git" as a tree, with a blob inside
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index 3241a3eb7..cdfb456b7 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -3,7 +3,6 @@
#include "git2/checkout.h"
#include "repository.h"
-#include "buffer.h"
#include "futils.h"
static git_repository *g_repo;
@@ -519,7 +518,7 @@ void assert_conflict(
git_index *index;
git_object *hack_tree;
git_reference *branch, *head;
- git_buf file_path = GIT_BUF_INIT;
+ git_str file_path = GIT_STR_INIT;
cl_git_pass(git_repository_index(&index, g_repo));
@@ -549,9 +548,9 @@ void assert_conflict(
g_object = NULL;
/* Create a conflicting file */
- cl_git_pass(git_buf_joinpath(&file_path, "./testrepo", entry_path));
- cl_git_mkfile(git_buf_cstr(&file_path), new_content);
- git_buf_dispose(&file_path);
+ cl_git_pass(git_str_joinpath(&file_path, "./testrepo", entry_path));
+ cl_git_mkfile(git_str_cstr(&file_path), new_content);
+ git_str_dispose(&file_path);
/* Trying to checkout the original commit */
cl_git_pass(git_revparse_single(&g_object, g_repo, commit_sha));
@@ -1037,17 +1036,17 @@ void test_checkout_tree__filemode_preserved_in_index(void)
mode_t read_filemode(const char *path)
{
- git_buf fullpath = GIT_BUF_INIT;
+ git_str fullpath = GIT_STR_INIT;
struct stat st;
mode_t result;
- git_buf_joinpath(&fullpath, "testrepo", path);
+ git_str_joinpath(&fullpath, "testrepo", path);
cl_must_pass(p_stat(fullpath.ptr, &st));
result = GIT_PERMS_IS_EXEC(st.st_mode) ?
GIT_FILEMODE_BLOB_EXECUTABLE : GIT_FILEMODE_BLOB;
- git_buf_dispose(&fullpath);
+ git_str_dispose(&fullpath);
return result;
}
@@ -1317,7 +1316,7 @@ void test_checkout_tree__caches_attributes_during_checkout(void)
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
git_oid oid;
git_object *obj = NULL;
- git_buf ident1 = GIT_BUF_INIT, ident2 = GIT_BUF_INIT;
+ git_str ident1 = GIT_STR_INIT, ident2 = GIT_STR_INIT;
char *ident_paths[] = { "ident1.txt", "ident2.txt" };
opts.progress_cb = update_attr_callback;
@@ -1346,8 +1345,8 @@ void test_checkout_tree__caches_attributes_during_checkout(void)
cl_assert_equal_strn(ident1.ptr, "# $Id: ", 7);
cl_assert_equal_strn(ident2.ptr, "# $Id: ", 7);
- git_buf_dispose(&ident1);
- git_buf_dispose(&ident2);
+ git_str_dispose(&ident1);
+ git_str_dispose(&ident2);
git_object_free(obj);
}
@@ -1679,6 +1678,6 @@ void test_checkout_tree__dry_run(void)
/* check that notify callback was invoked */
cl_assert_equal_i(ct.n_updates, 2);
-
+
git_object_free(obj);
}
diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c
index db3f02a5c..205ce657f 100644
--- a/tests/checkout/typechange.c
+++ b/tests/checkout/typechange.c
@@ -90,7 +90,7 @@ static void assert_workdir_matches_tree(
git_object *obj;
git_tree *tree;
size_t i, max_i;
- git_buf path = GIT_BUF_INIT;
+ git_str path = GIT_STR_INIT;
if (!root)
root = git_repository_workdir(repo);
@@ -106,7 +106,7 @@ static void assert_workdir_matches_tree(
const git_tree_entry *te = git_tree_entry_byindex(tree, i);
cl_assert(te);
- cl_git_pass(git_buf_joinpath(&path, root, git_tree_entry_name(te)));
+ cl_git_pass(git_str_joinpath(&path, root, git_tree_entry_name(te)));
switch (git_tree_entry_type(te)) {
case GIT_OBJECT_COMMIT:
@@ -139,7 +139,7 @@ static void assert_workdir_matches_tree(
}
git_tree_free(tree);
- git_buf_dispose(&path);
+ git_str_dispose(&path);
}
void test_checkout_typechange__checkout_typechanges_safe(void)
@@ -226,31 +226,31 @@ static void force_create_file(const char *file)
static int make_submodule_dirty(git_submodule *sm, const char *name, void *payload)
{
- git_buf submodulepath = GIT_BUF_INIT;
- git_buf dirtypath = GIT_BUF_INIT;
+ git_str submodulepath = GIT_STR_INIT;
+ git_str dirtypath = GIT_STR_INIT;
git_repository *submodule_repo;
GIT_UNUSED(name);
GIT_UNUSED(payload);
/* remove submodule directory in preparation for init and repo_init */
- cl_git_pass(git_buf_joinpath(
+ cl_git_pass(git_str_joinpath(
&submodulepath,
git_repository_workdir(g_repo),
git_submodule_path(sm)
));
- git_futils_rmdir_r(git_buf_cstr(&submodulepath), NULL, GIT_RMDIR_REMOVE_FILES);
+ git_futils_rmdir_r(git_str_cstr(&submodulepath), NULL, GIT_RMDIR_REMOVE_FILES);
/* initialize submodule's repository */
cl_git_pass(git_submodule_repo_init(&submodule_repo, sm, 0));
/* create a file in the submodule workdir to make it dirty */
cl_git_pass(
- git_buf_joinpath(&dirtypath, git_repository_workdir(submodule_repo), "dirty"));
- force_create_file(git_buf_cstr(&dirtypath));
+ git_str_joinpath(&dirtypath, git_repository_workdir(submodule_repo), "dirty"));
+ force_create_file(git_str_cstr(&dirtypath));
- git_buf_dispose(&dirtypath);
- git_buf_dispose(&submodulepath);
+ git_str_dispose(&dirtypath);
+ git_str_dispose(&submodulepath);
git_repository_free(submodule_repo);
return 0;