summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-04-22 23:19:59 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2023-04-24 11:49:12 +0100
commitdd15c615bde54eb02c5cec17257a83dcd8528371 (patch)
tree882f31fe53a21966733e67ef759d678bce13b62f /src
parent190a4c55df72b32adf4d60f77cbc47276b74f84b (diff)
downloadlibgit2-dd15c615bde54eb02c5cec17257a83dcd8528371.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/libgit2/commit.c5
-rw-r--r--src/libgit2/grafts.c6
-rw-r--r--src/libgit2/grafts.h2
-rw-r--r--src/libgit2/libgit2.c4
-rw-r--r--src/libgit2/repository.c2
5 files changed, 4 insertions, 15 deletions
diff --git a/src/libgit2/commit.c b/src/libgit2/commit.c
index a7d831115..f7be73acf 100644
--- a/src/libgit2/commit.c
+++ b/src/libgit2/commit.c
@@ -553,14 +553,11 @@ int git_commit__parse_ext(
git_repository *repo = git_object_owner((git_object *)commit);
git_commit_graft *graft;
int error;
-
+
if ((error = commit_parse(commit, git_odb_object_data(odb_obj),
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)
diff --git a/src/libgit2/grafts.c b/src/libgit2/grafts.c
index 7cbb1dd76..13c33aad0 100644
--- a/src/libgit2/grafts.c
+++ b/src/libgit2/grafts.c
@@ -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;
@@ -97,13 +95,13 @@ int git_grafts_refresh(git_grafts *grafts)
if (!grafts->path)
return 0;
- if ((error = git_futils_readbuffer_updated(&contents, grafts->path,
+ if ((error = git_futils_readbuffer_updated(&contents, grafts->path,
(grafts->path_checksum).id, &updated)) < 0) {
if (error == GIT_ENOTFOUND) {
git_grafts_clear(grafts);
error = 0;
}
-
+
goto cleanup;
}
diff --git a/src/libgit2/grafts.h b/src/libgit2/grafts.h
index 4139438bb..fc61468f5 100644
--- a/src/libgit2/grafts.h
+++ b/src/libgit2/grafts.h
@@ -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);
diff --git a/src/libgit2/libgit2.c b/src/libgit2/libgit2.c
index c5a9287fb..178880c9e 100644
--- a/src/libgit2/libgit2.c
+++ b/src/libgit2/libgit2.c
@@ -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;
diff --git a/src/libgit2/repository.c b/src/libgit2/repository.c
index 1e356c84e..99982b724 100644
--- a/src/libgit2/repository.c
+++ b/src/libgit2/repository.c
@@ -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) {