aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-12-05 14:49:58 +0900
committerJunio C Hamano <gitster@pobox.com>2025-12-05 14:49:58 +0900
commit9d442ce2e21fc02332378c6026b011bb5ced1856 (patch)
treed2074c0ead08d882f8cd824584d0b2814c3b5a4b /builtin
parent1b40ddc1a5e2eecd54802c3c6c3c940b0306542a (diff)
parentac65c70663b092e823b0d3de1c1cfdee0a4fbc8e (diff)
downloadgit-9d442ce2e21fc02332378c6026b011bb5ced1856.tar.xz
Merge branch 'ps/object-source-management'
Code refactoring around object database sources. * ps/object-source-management: odb: handle recreation of quarantine directories odb: handle changing a repository's commondir chdir-notify: add function to unregister listeners odb: handle initialization of sources in `odb_new()` http-push: stop setting up `the_repository` for each reference t/helper: stop setting up `the_repository` repeatedly builtin/index-pack: fix deferred fsck outside repos oidset: introduce `oidset_equal()` odb: move logic to disable ref updates into repo odb: refactor `odb_clear()` to `odb_free()` odb: adopt logic to close object databases setup: convert `set_git_dir()` to have file scope path: move `enter_repo()` into "setup.c"
Diffstat (limited to 'builtin')
-rw-r--r--builtin/clone.c2
-rw-r--r--builtin/gc.c2
-rw-r--r--builtin/index-pack.c21
-rw-r--r--builtin/receive-pack.c2
-rw-r--r--builtin/repack.c2
-rw-r--r--builtin/upload-archive.c2
-rw-r--r--builtin/upload-pack.c2
7 files changed, 24 insertions, 9 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index c990f398ef..b19b302b06 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1617,7 +1617,7 @@ int cmd_clone(int argc,
transport_disconnect(transport);
if (option_dissociate) {
- close_object_store(the_repository->objects);
+ odb_close(the_repository->objects);
dissociate_from_references();
}
diff --git a/builtin/gc.c b/builtin/gc.c
index e9a76243aa..92c6e7b954 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1063,7 +1063,7 @@ int cmd_gc(int argc,
report_garbage = report_pack_garbage;
odb_reprepare(the_repository->objects);
if (pack_garbage.nr > 0) {
- close_object_store(the_repository->objects);
+ odb_close(the_repository->objects);
clean_pack_garbage();
}
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 2b78ba7fe4..699fe678cd 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1640,7 +1640,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
rename_tmp_packfile(&final_index_name, curr_index_name, &index_name,
hash, "idx", 1);
- if (do_fsck_object)
+ if (do_fsck_object && startup_info->have_repository)
packfile_store_load_pack(the_repository->objects->packfiles,
final_index_name, 0);
@@ -2110,8 +2110,23 @@ int cmd_index_pack(int argc,
else
close(input_fd);
- if (do_fsck_object && fsck_finish(&fsck_options))
- die(_("fsck error in pack objects"));
+ if (do_fsck_object) {
+ /*
+ * We cannot perform queued consistency checks when running
+ * outside of a repository because those require us to read
+ * from the object database, which is uninitialized.
+ *
+ * TODO: we may eventually set up an in-memory object database,
+ * which would allow us to perform these queued checks.
+ */
+ if (!startup_info->have_repository &&
+ fsck_has_queued_checks(&fsck_options))
+ die(_("cannot perform queued object checks outside "
+ "of a repository"));
+
+ if (fsck_finish(&fsck_options))
+ die(_("fsck error in pack objects"));
+ }
free(opts.anomaly);
free(objects);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 28a6404219..9c49174616 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -34,7 +34,6 @@
#include "object-file.h"
#include "object-name.h"
#include "odb.h"
-#include "path.h"
#include "protocol.h"
#include "commit-reach.h"
#include "server-info.h"
@@ -42,6 +41,7 @@
#include "trace2.h"
#include "worktree.h"
#include "shallow.h"
+#include "setup.h"
#include "parse-options.h"
static const char * const receive_pack_usage[] = {
diff --git a/builtin/repack.c b/builtin/repack.c
index cfdb4c0920..d9012141f6 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -488,7 +488,7 @@ int cmd_repack(int argc,
string_list_sort(&names);
- close_object_store(repo->objects);
+ odb_close(repo->objects);
/*
* Ok we have prepared all new packfiles.
diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c
index 97d7c9522f..25312bb2a5 100644
--- a/builtin/upload-archive.c
+++ b/builtin/upload-archive.c
@@ -4,8 +4,8 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "archive.h"
-#include "path.h"
#include "pkt-line.h"
+#include "setup.h"
#include "sideband.h"
#include "run-command.h"
#include "strvec.h"
diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c
index c2bbc035ab..30498fafea 100644
--- a/builtin/upload-pack.c
+++ b/builtin/upload-pack.c
@@ -5,11 +5,11 @@
#include "gettext.h"
#include "pkt-line.h"
#include "parse-options.h"
-#include "path.h"
#include "protocol.h"
#include "replace-object.h"
#include "upload-pack.h"
#include "serve.h"
+#include "setup.h"
#include "commit.h"
#include "environment.h"