Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libgit2/repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,7 @@ static const char *builtin_extensions[] = {
"noop",
"objectformat",
"worktreeconfig",
"preciousobjects"
};

static git_vector user_extensions = { 0, git__strcmp_cb };
Expand Down
20 changes: 12 additions & 8 deletions tests/libgit2/core/opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ void test_core_opts__extensions_query(void)

cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));

cl_assert_equal_sz(out.count, 3);
cl_assert_equal_sz(out.count, 4);
cl_assert_equal_s("noop", out.strings[0]);
cl_assert_equal_s("objectformat", out.strings[1]);
cl_assert_equal_s("worktreeconfig", out.strings[2]);
cl_assert_equal_s("preciousobjects", out.strings[2]);
cl_assert_equal_s("worktreeconfig", out.strings[3]);

git_strarray_dispose(&out);
}
Expand All @@ -50,11 +51,12 @@ void test_core_opts__extensions_add(void)
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_EXTENSIONS, in, ARRAY_SIZE(in)));
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));

cl_assert_equal_sz(out.count, 4);
cl_assert_equal_sz(out.count, 5);
cl_assert_equal_s("foo", out.strings[0]);
cl_assert_equal_s("noop", out.strings[1]);
cl_assert_equal_s("objectformat", out.strings[2]);
cl_assert_equal_s("worktreeconfig", out.strings[3]);
cl_assert_equal_s("preciousobjects", out.strings[3]);
cl_assert_equal_s("worktreeconfig", out.strings[4]);

git_strarray_dispose(&out);
}
Expand All @@ -67,11 +69,12 @@ void test_core_opts__extensions_remove(void)
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_EXTENSIONS, in, ARRAY_SIZE(in)));
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));

cl_assert_equal_sz(out.count, 4);
cl_assert_equal_sz(out.count, 5);
cl_assert_equal_s("bar", out.strings[0]);
cl_assert_equal_s("baz", out.strings[1]);
cl_assert_equal_s("objectformat", out.strings[2]);
cl_assert_equal_s("worktreeconfig", out.strings[3]);
cl_assert_equal_s("preciousobjects", out.strings[3]);
cl_assert_equal_s("worktreeconfig", out.strings[4]);

git_strarray_dispose(&out);
}
Expand All @@ -84,12 +87,13 @@ void test_core_opts__extensions_uniq(void)
cl_git_pass(git_libgit2_opts(GIT_OPT_SET_EXTENSIONS, in, ARRAY_SIZE(in)));
cl_git_pass(git_libgit2_opts(GIT_OPT_GET_EXTENSIONS, &out));

cl_assert_equal_sz(out.count, 5);
cl_assert_equal_sz(out.count, 6);
cl_assert_equal_s("bar", out.strings[0]);
cl_assert_equal_s("foo", out.strings[1]);
cl_assert_equal_s("noop", out.strings[2]);
cl_assert_equal_s("objectformat", out.strings[3]);
cl_assert_equal_s("worktreeconfig", out.strings[4]);
cl_assert_equal_s("preciousobjects", out.strings[4]);
cl_assert_equal_s("worktreeconfig", out.strings[5]);

git_strarray_dispose(&out);
}
10 changes: 10 additions & 0 deletions tests/libgit2/repo/extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,13 @@ void test_repo_extensions__adds_extension(void)
cl_assert(git__suffixcmp(git_repository_path(extended), "/") == 0);
git_repository_free(extended);
}

void test_repo_extensions__preciousobjects(void)
{
git_repository *extended = NULL;

cl_repo_set_string(repo, "extensions.preciousObjects", "true");

cl_git_pass(git_repository_open(&extended, "empty_bare.git"));
git_repository_free(extended);
}
Loading