Commit dd15c615 by Edward Thomson

shallow: remove feature flag

The opt mechanism isn't _really_ meant to be for feature flags, and it's
weird to feature flag shallow / unshallow at all.
parent 190a4c55
......@@ -224,8 +224,7 @@ typedef enum {
GIT_OPT_GET_OWNER_VALIDATION,
GIT_OPT_SET_OWNER_VALIDATION,
GIT_OPT_GET_HOMEDIR,
GIT_OPT_SET_HOMEDIR,
GIT_OPT_ENABLE_SHALLOW
GIT_OPT_SET_HOMEDIR
} git_libgit2_opt_t;
/**
......@@ -463,9 +462,6 @@ typedef enum {
* > to support repositories with the `noop` extension but does want
* > to support repositories with the `newext` extension.
*
* opts(GIT_OPT_ENABLE_SHALLOW, int enabled)
* > Enable or disable shallow clone support completely.
*
* opts(GIT_OPT_GET_OWNER_VALIDATION, int *enabled)
* > Gets the owner validation setting for repository
* > directories.
......
......@@ -558,9 +558,6 @@ int git_commit__parse_ext(
git_odb_object_size(odb_obj), parse_opts)) < 0)
return error;
if (!git_shallow__enabled)
return 0;
/* Perform necessary grafts */
if (git_grafts_get(&graft, repo->grafts, git_odb_object_id(odb_obj)) != 0 &&
git_grafts_get(&graft, repo->shallow_grafts, git_odb_object_id(odb_obj)) != 0)
......
......@@ -12,8 +12,6 @@
#include "oidarray.h"
#include "parse.h"
bool git_shallow__enabled = false;
struct git_grafts {
/* Map of `git_commit_graft`s */
git_oidmap *commits;
......
......@@ -19,8 +19,6 @@ typedef struct {
typedef struct git_grafts git_grafts;
extern bool git_shallow__enabled;
int git_grafts_new(git_grafts **out);
int git_grafts_from_file(git_grafts **out, const char *path);
void git_grafts_free(git_grafts *grafts);
......
......@@ -436,10 +436,6 @@ int git_libgit2_opts(int key, ...)
error = git_sysdir_set(GIT_SYSDIR_HOME, va_arg(ap, const char *));
break;
case GIT_OPT_ENABLE_SHALLOW:
git_shallow__enabled = (va_arg(ap, int) != 0);
break;
default:
git_error_set(GIT_ERROR_INVALID, "invalid option key");
error = -1;
......
......@@ -1099,7 +1099,7 @@ int git_repository_open_ext(
if (error < 0)
goto cleanup;
if (git_shallow__enabled && (error = load_grafts(repo)) < 0)
if ((error = load_grafts(repo)) < 0)
goto cleanup;
if ((flags & GIT_REPOSITORY_OPEN_BARE) != 0) {
......
......@@ -4,12 +4,10 @@
void test_clone_shallow__initialize(void)
{
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 1));
}
void test_clone_shallow__cleanup(void)
{
git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 0);
}
static int remote_single_branch(git_remote **out, git_repository *repo, const char *name, const char *url, void *payload)
......
......@@ -7,13 +7,11 @@ static git_repository *g_repo;
void test_grafts_basic__initialize(void)
{
git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 1);
g_repo = cl_git_sandbox_init("grafted.git");
}
void test_grafts_basic__cleanup(void)
{
git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 0);
cl_git_sandbox_cleanup();
}
......
......@@ -7,25 +7,13 @@
static git_repository *g_repo;
static git_oid g_shallow_oid;
void test_grafts_shallow__set_feature_flag(void)
{
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 1));
}
void test_grafts_shallow__unset_feature_flag(void)
{
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 0));
}
void test_grafts_shallow__initialize(void)
{
git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 1);
cl_git_pass(git_oid__fromstr(&g_shallow_oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1));
}
void test_grafts_shallow__cleanup(void)
{
git_libgit2_opts(GIT_OPT_ENABLE_SHALLOW, 0);
cl_git_sandbox_cleanup();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment