]> git.ipfire.org Git - thirdparty/git.git/commitdiff
object-store-ll.h: split this header out of object-store.h
authorElijah Newren <newren@gmail.com>
Tue, 16 May 2023 06:34:06 +0000 (06:34 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Jun 2023 20:39:54 +0000 (13:39 -0700)
The vast majority of files including object-store.h did not need dir.h
nor khash.h.  Split the header into two files, and let most just depend
upon object-store-ll.h, while letting the two callers that need it
depend on the full object-store.h.

After this patch:
    $ git grep -h include..object-store | sort | uniq -c
          2 #include "object-store.h"
        129 #include "object-store-ll.h"

Diff best viewed with `--color-moved`.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
131 files changed:
apply.c
archive-tar.c
archive-zip.c
archive.c
attr.c
bisect.c
blame.c
builtin/blame.c
builtin/cat-file.c
builtin/checkout.c
builtin/clone.c
builtin/commit-graph.c
builtin/commit-tree.c
builtin/count-objects.c
builtin/describe.c
builtin/difftool.c
builtin/fast-export.c
builtin/fast-import.c
builtin/fetch.c
builtin/fsck.c
builtin/gc.c
builtin/grep.c
builtin/hash-object.c
builtin/index-pack.c
builtin/log.c
builtin/ls-tree.c
builtin/merge-tree.c
builtin/mktag.c
builtin/mktree.c
builtin/multi-pack-index.c
builtin/notes.c
builtin/pack-objects.c
builtin/pack-redundant.c
builtin/prune.c
builtin/receive-pack.c
builtin/remote.c
builtin/repack.c
builtin/replace.c
builtin/rev-list.c
builtin/show-ref.c
builtin/submodule--helper.c
builtin/tag.c
builtin/unpack-file.c
builtin/unpack-objects.c
builtin/verify-commit.c
bulk-checkin.c
bundle-uri.c
bundle.c
cache-tree.c
combine-diff.c
commit-graph.c
commit-graph.h
commit.c
config.c
connected.c
convert.c
diagnose.c
diff.c
diffcore-rename.c
dir.c
entry.c
environment.c
fetch-pack.c
fmt-merge-msg.c
fsck.c
grep.c
http-backend.c
http-push.c
http-walker.c
http.c
list-objects-filter.c
list-objects.c
log-tree.c
mailmap.c
match-trees.c
merge-blobs.c
merge-ort.c
merge-recursive.c
midx.c
notes-cache.c
notes-merge.c
notes.c
object-name.c
object-store-ll.h [new file with mode: 0644]
object-store.h
oss-fuzz/fuzz-pack-idx.c
pack-bitmap-write.c
pack-bitmap.c
pack-check.c
pack-mtimes.c
pack-objects.h
pack-revindex.c
pack-write.c
packfile.c
path.c
promisor-remote.c
protocol-caps.c
prune-packed.c
reachable.c
read-cache.c
ref-filter.c
reflog.c
refs.c
remote.c
replace-object.c
replace-object.h
repository.c
rerere.c
revision.c
send-pack.c
sequencer.c
server-info.c
shallow.c
streaming.c
submodule-config.c
submodule.c
t/helper/test-pack-mtimes.c
t/helper/test-partial-clone.c
t/helper/test-read-graph.c
t/helper/test-read-midx.c
t/helper/test-ref-store.c
t/helper/test-repository.c
tag.c
tmp-objdir.c
transport.c
tree-walk.c
tree.c
unpack-trees.c
upload-pack.c
walker.c
xdiff-interface.c

diff --git a/apply.c b/apply.c
index 2f66f93fec583ddc67870c14859dd9f096776421..8bd0109fcc8dfdb869a1a1eea546227659ceb33d 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -12,7 +12,7 @@
 #include "alloc.h"
 #include "base85.h"
 #include "config.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "blob.h"
 #include "delta.h"
 #include "diff.h"
index 4cd81d8161e738c582d47709a90bc2f55d838f50..fc06ff4c5d69b3580ffffaac769186c52878902e 100644 (file)
@@ -9,7 +9,7 @@
 #include "hex.h"
 #include "tar.h"
 #include "archive.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "streaming.h"
 #include "run-command.h"
 #include "write-or-die.h"
index d0d065a312eeca3b1e9399f6d4adad46a05d8f60..b4382640966ceb2353ed0866fb10d1c8eadf545b 100644 (file)
@@ -9,7 +9,7 @@
 #include "hex.h"
 #include "streaming.h"
 #include "utf8.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "userdiff.h"
 #include "write-or-die.h"
 #include "xdiff-interface.h"
index 2ad5f4420112d3d8b631bb750d2196a56413165c..1817cca9f4ccec4d7dc45c3d539f11170862bb25 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -10,7 +10,7 @@
 #include "pretty.h"
 #include "setup.h"
 #include "refs.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit.h"
 #include "tree.h"
 #include "tree-walk.h"
diff --git a/attr.c b/attr.c
index 2514c8a002cf3df6ed03ef5edcd8f843ba0a6f84..7d39ac4a29bc628e173b85e4b235e70cf01841cc 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -19,7 +19,7 @@
 #include "quote.h"
 #include "read-cache-ll.h"
 #include "revision.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "setup.h"
 #include "thread-utils.h"
 #include "tree-walk.h"
index 9f7cf0be0733eefc4c71bd6e3192c788e007b776..1be8e0a2711df9d29c1ba903fd4e8901379ea406 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -18,7 +18,7 @@
 #include "commit-slab.h"
 #include "commit-reach.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "dir.h"
 
diff --git a/blame.c b/blame.c
index 2e25a7254c890bbfd343637f323d3db1a2fc2d87..d12bd9f97ba5c1808913c72bac4473509c340827 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "refs.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "cache-tree.h"
 #include "mergesort.h"
 #include "convert.h"
index 2df6039a6e0e139227c937023b8d8565e5ceb611..e811e7fbfb1e0425b334aa0f91ac7527b0d316a1 100644 (file)
@@ -29,7 +29,7 @@
 #include "dir.h"
 #include "progress.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pager.h"
 #include "blame.h"
 #include "refs.h"
index 9646e7209ca5a5b92983ec8a437994c871ba6b03..48ccca95a1ad17fdbaccc5731e8779bee14b0286 100644 (file)
@@ -21,7 +21,7 @@
 #include "packfile.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "replace-object.h"
 #include "promisor-remote.h"
 #include "mailmap.h"
index 11e2359c5487b4069d5d9414673eff579bcbc807..fd6ee8c2723b05be9d4a390a08f6c6bed84a5291 100644 (file)
@@ -18,7 +18,7 @@
 #include "mem-pool.h"
 #include "merge-recursive.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "parse-options.h"
 #include "path.h"
 #include "preload-index.h"
index 6c5cb33f6a9f87ac934e8b0ab212a1ff79cc789c..687a686269a4ab241a168e7675080791f0c7b065 100644 (file)
@@ -23,7 +23,7 @@
 #include "refs.h"
 #include "refspec.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "tree.h"
 #include "tree-walk.h"
 #include "unpack-trees.h"
index 96a8a67732777f291bcd491efbfcc57c2a72b01f..48fa9f20c977e24f46ed21c1e4fd835b67d4009a 100644 (file)
@@ -9,7 +9,7 @@
 #include "parse-options.h"
 #include "repository.h"
 #include "commit-graph.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "progress.h"
 #include "replace-object.h"
 #include "tag.h"
index d2121f30d45bd75fea852393920dab76320f25d6..02625e71761dbf8d25f063b5ff4835e5eb4bf477 100644 (file)
@@ -8,7 +8,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "repository.h"
 #include "commit.h"
 #include "tree.h"
index c9f82d0bce9d57e39597b1f1526642f9b8f4bf55..97cdfb0ac57c6ae534bf2646a84dccf5b19bd229 100644 (file)
@@ -14,7 +14,7 @@
 #include "parse-options.h"
 #include "quote.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 static unsigned long garbage;
 static off_t size_garbage;
index eb19ab0bbbeb1a392f464fd9aac42f4c6716f7d0..7ce23e1b8e6a13eb9494ba415cfefbbcfd96e83d 100644 (file)
@@ -19,7 +19,7 @@
 #include "setup.h"
 #include "strvec.h"
 #include "run-command.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "list-objects.h"
 #include "commit-slab.h"
 #include "wildmatch.h"
index 4a22de3eddbbb2fe00aef5b8e77241c09d39234f..e2c9ab7d5d7354783ef3e12d29a770fa82122c5f 100644 (file)
@@ -28,7 +28,7 @@
 #include "strbuf.h"
 #include "lockfile.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "dir.h"
 #include "entry.h"
 #include "setup.h"
index 5f3ffd6912f47eb04961910d09bc6aa60c8f943f..56dc69fac180126a43f8a9ca3ed116ca67283737 100644 (file)
@@ -10,7 +10,7 @@
 #include "refs.h"
 #include "refspec.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit.h"
 #include "object.h"
 #include "tag.h"
index 5698b92ae7db0b40a28edd0c7d418f43b01ab0a7..2ee19c737332ca25b49740a0bc1662bc83111ad0 100644 (file)
@@ -21,7 +21,7 @@
 #include "packfile.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "mem-pool.h"
 #include "commit-reach.h"
 #include "khash.h"
index d51b28fe2e5eafa8368d24d5e46db21e794181c6..951a23d73310b98b093f9d572c306c402b4f250d 100644 (file)
@@ -11,7 +11,7 @@
 #include "refs.h"
 #include "refspec.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oidset.h"
 #include "oid-array.h"
 #include "commit.h"
index 88c466c048e87fe11fdc98b3675b5f0a1a22b777..b81f1a2010967efad6ab662cc33af3bef444e7e6 100644 (file)
@@ -20,7 +20,7 @@
 #include "packfile.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "read-cache-ll.h"
 #include "replace-object.h"
index aeceed4117f9fa21c9f84eb5251baeed148a8aad..91eec7703a58ce1b2b66e007a6726a2a86835cf0 100644 (file)
@@ -27,7 +27,7 @@
 #include "commit-graph.h"
 #include "packfile.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pack.h"
 #include "pack-objects.h"
 #include "path.h"
index 6bc8abcd3e126f2ea93ac9f56d9c8f0120597b42..72e70b3a48dc6b30f2c71018aac274cf30f7574f 100644 (file)
@@ -27,7 +27,7 @@
 #include "submodule-config.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "packfile.h"
 #include "pager.h"
 #include "path.h"
index a3801211666410eb703fa11bd24a4ba03ff3e6ea..5ffec99dceaf5c95d9b57c1f0c6c90358b80507d 100644 (file)
 #include "gettext.h"
 #include "hex.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "blob.h"
 #include "quote.h"
 #include "parse-options.h"
 #include "exec-cmd.h"
 #include "setup.h"
+#include "strbuf.h"
 #include "write-or-die.h"
 
 /*
index bb67e16655994ceee8116a6325ead1daf1d8e860..820860265d0b09a810406c8290b36f627052f565 100644 (file)
 #include "progress.h"
 #include "fsck.h"
 #include "exec-cmd.h"
+#include "strbuf.h"
 #include "streaming.h"
 #include "thread-utils.h"
 #include "packfile.h"
 #include "pack-revindex.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oid-array.h"
 #include "replace-object.h"
 #include "promisor-remote.h"
index c85f13a5d5e3c7cb774b1272232840403a00bf8a..89442dcedae26e94b737d69bdec8ebe787a37642 100644 (file)
@@ -14,7 +14,7 @@
 #include "refs.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pager.h"
 #include "color.h"
 #include "commit.h"
index c06858de4bf3ec38ac81ad8f1f7a7c93ac978c16..4e17f13648ecfefe683ac56df6789e58b84ae02e 100644 (file)
@@ -8,7 +8,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "blob.h"
 #include "tree.h"
 #include "commit.h"
index 4325897a809bac36d9579bf55a4af45a7c77fd2d..6f7db436d20c6c897096c85e9dbb35fc5c08c4d8 100644 (file)
@@ -9,7 +9,7 @@
 #include "commit-reach.h"
 #include "merge-ort.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "parse-options.h"
 #include "repository.h"
 #include "blob.h"
index 44fa56eff38c298f5444ff1c7dc5fdfdbd1adc7d..43e2766db4934e371659068952c8d4a4705aaa53 100644 (file)
@@ -2,10 +2,11 @@
 #include "gettext.h"
 #include "hex.h"
 #include "parse-options.h"
+#include "strbuf.h"
 #include "tag.h"
 #include "replace-object.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "fsck.h"
 #include "config.h"
 
index 09a7bd5c5c250fb22ca204932c6e00c50de62690..0eea810c7ea390995cb804f8c6c14e59a04244af 100644 (file)
@@ -8,9 +8,10 @@
 #include "gettext.h"
 #include "hex.h"
 #include "quote.h"
+#include "strbuf.h"
 #include "tree.h"
 #include "parse-options.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 static struct treeent {
        unsigned mode;
index 5bb71bce08d5cce37b909fef66f30b07ff0b32d2..a31dde1db9ea37107b23bb2fd856ba0165ebfae4 100644 (file)
@@ -5,8 +5,9 @@
 #include "gettext.h"
 #include "parse-options.h"
 #include "midx.h"
+#include "strbuf.h"
 #include "trace2.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 #define BUILTIN_MIDX_WRITE_USAGE \
        N_("git multi-pack-index [<options>] write [--preferred-pack=<pack>]" \
index 0a870d908364b1b7db2ace66f75df6dbd3387501..0a19796f734df1104ef90199b6e06b8068d2c8b6 100644 (file)
@@ -14,7 +14,7 @@
 #include "hex.h"
 #include "notes.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "repository.h"
 #include "blob.h"
index 9cfc8801f9bb9aea42aa2031a0bc3f6a8963d89b..af9352b2280e80204f839f675cf8b2d9709e98ca 100644 (file)
@@ -34,7 +34,7 @@
 #include "list.h"
 #include "packfile.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "replace-object.h"
 #include "dir.h"
 #include "midx.h"
index 43e9d12dfdc2075efd9f3aab5e0f4d38a5ad73a4..4c735ba069caf6626791d85741f78c3869a5c89d 100644 (file)
@@ -11,7 +11,7 @@
 #include "hex.h"
 #include "repository.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 #define BLKSIZE 512
 
index a46c5aa2b5b2d53b209e988b137a62aa78a26186..cfb863ae848c4446f720a5242c0e4bb33cab4070 100644 (file)
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "commit.h"
 #include "diff.h"
+#include "dir.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
@@ -13,7 +14,7 @@
 #include "replace-object.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "shallow.h"
 
 static const char * const prune_usage[] = {
index d1718a3ac903e96a249e61eeeb10cb00c0510ada..91caaf87066372dcbf0c8289d2f576df9d25186a 100644 (file)
@@ -30,7 +30,7 @@
 #include "oidset.h"
 #include "packfile.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "protocol.h"
 #include "commit-reach.h"
index 3794f13330d7b8654e5c977c672ee710e80fa3c3..7d96687ec74d3f3a336d67e0b6823a011932ab29 100644 (file)
@@ -11,7 +11,7 @@
 #include "rebase.h"
 #include "refs.h"
 #include "refspec.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "strvec.h"
 #include "commit-reach.h"
 #include "progress.h"
index fe8d5810d486ea18cd6fea502310b0878802a43e..6c896c9c80561b24a9d2a896f633668ae7ec84ed 100644 (file)
@@ -16,7 +16,7 @@
 #include "midx.h"
 #include "packfile.h"
 #include "prune-packed.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "promisor-remote.h"
 #include "shallow.h"
 #include "pack.h"
index a2f57a56b3e986b1c928cabe031e4335c3b48d4f..20c67a58890eb5399276ac0beea01eaf9867d5cc 100644 (file)
@@ -20,7 +20,7 @@
 #include "run-command.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "replace-object.h"
 #include "repository.h"
 #include "tag.h"
index 8029f3de53c46c743c20cd1ab98a9d67cf5f4cf9..ff715d6918f004265cf8801879f13fc189f09709 100644 (file)
@@ -12,7 +12,7 @@
 #include "object.h"
 #include "object-name.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pack.h"
 #include "pack-bitmap.h"
 #include "log-tree.h"
index e07e9ca862fc7be01604191ffaa38c41c1ee94c6..5110814f7960870aa4f1df60965f2234088f859f 100644 (file)
@@ -4,7 +4,7 @@
 #include "hex.h"
 #include "refs.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "object.h"
 #include "tag.h"
 #include "string-list.h"
index 5fddfb158d138c3d1d7736b3891832ff2bcf94ce..6321d7e9c9647d943a378b9d1c038cbe13012963 100644 (file)
@@ -29,7 +29,7 @@
 #include "diff.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "advice.h"
 #include "branch.h"
 #include "list-objects-filter-options.h"
index 26122dd103a506332040f6f991daf6d7a428a2ba..e63bee8eab25c966f9c6f4f3bb238fa17636ed7f 100644 (file)
@@ -15,7 +15,7 @@
 #include "hex.h"
 #include "refs.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "tag.h"
 #include "run-command.h"
index b35a4b9dfee83e9050771bf0f6d51555f1b32dcd..6842a6c499631a26d2caa3421ac9b1d2cec212f2 100644 (file)
@@ -2,7 +2,7 @@
 #include "config.h"
 #include "hex.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "wrapper.h"
 
 static char *create_temp_file(struct object_id *oid)
index 85baf6a131aa099f38ffa7745992ee4a817e3cf2..b4b46ae729122565c73e895f6ebfbbb33c463360 100644 (file)
@@ -5,7 +5,7 @@
 #include "gettext.h"
 #include "git-zlib.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "object.h"
 #include "delta.h"
 #include "pack.h"
index aa34fb896ace61d93716ac2b506a0f48e5a7ffd4..9680b5870130615b7b4432a5ce456279db750aa4 100644 (file)
@@ -9,7 +9,7 @@
 #include "config.h"
 #include "gettext.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "repository.h"
 #include "commit.h"
 #include "run-command.h"
index d843279715c3369ed92f853bd91c0e846af55049..e2f71db0f60f021b23574eb2ae10c1809e05d365 100644 (file)
@@ -16,7 +16,7 @@
 #include "tmp-objdir.h"
 #include "packfile.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "wrapper.h"
 
 static int odb_transaction_nesting;
index 2a2db1a1d390f89be51cbad4b5313d4ac67ad5c0..a97dcbdb860379e1d3d308e80f9f9d5db54780d3 100644 (file)
@@ -4,7 +4,7 @@
 #include "copy.h"
 #include "environment.h"
 #include "gettext.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "refs.h"
 #include "run-command.h"
 #include "hashmap.h"
index a5505368de5a9190e0ee6238b6f905cfca5f0efe..8d5936c4212da4cfc3162aec8f83f15318ca002c 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -4,7 +4,7 @@
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "repository.h"
 #include "object.h"
 #include "commit.h"
index 077932c2db519a439b7af19dff7c874b59194274..84d7491420ed78c576e3370b500bc80b6c50f6df 100644 (file)
@@ -8,7 +8,7 @@
 #include "cache-tree.h"
 #include "bulk-checkin.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "read-cache-ll.h"
 #include "replace-object.h"
 #include "promisor-remote.h"
index 1e3cd7fb170413eb47677269a77526b41e0ba5c7..11e9d7494a179230481bd1f64b8a7ee406e5a38f 100644 (file)
@@ -1,5 +1,5 @@
 #include "git-compat-util.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit.h"
 #include "convert.h"
 #include "blob.h"
index 25cbd66c33ab24589d7e12a4817d5564e49e4eb4..9e989f43491a6807efb99423b7688c12359ada95 100644 (file)
@@ -12,7 +12,7 @@
 #include "hash-lookup.h"
 #include "commit-graph.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oid-array.h"
 #include "path.h"
 #include "alloc.h"
index 83aaa1dbb929c4f16acbe8ccb2593d104af2b7f0..5e534f0fcc8d131a6e759ed1658b0e0984123a6e 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef COMMIT_GRAPH_H
 #define COMMIT_GRAPH_H
 
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oidset.h"
 
 #define GIT_TEST_COMMIT_GRAPH "GIT_TEST_COMMIT_GRAPH"
index 0fb9316931a9da64aa9441e5bb160b98e5656faf..65077910618369e5f837f1790890b976c7d6e9e0 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -7,7 +7,7 @@
 #include "hex.h"
 #include "repository.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pkt-line.h"
 #include "utf8.h"
 #include "diff.h"
index 27ae207280ba5de0bef0d80219bfa9853d4b5c37..50f4b409aad19eb2b2d34769c4d37beae59050f2 100644 (file)
--- a/config.c
+++ b/config.c
@@ -25,7 +25,7 @@
 #include "hashmap.h"
 #include "string-list.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pager.h"
 #include "path.h"
 #include "utf8.h"
index d672521da41d524f49556aefc29427b20836b8d2..8f89376dbcf30cd2cf69c3d2eaa446e47c9f4ae8 100644 (file)
@@ -1,7 +1,7 @@
 #include "git-compat-util.h"
 #include "gettext.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "run-command.h"
 #include "sigchain.h"
 #include "connected.h"
index 572d7123a92ee68fc1eb5766689ff929c388f543..3d8325d49e719501c1148bc123008d3a3aaa7e65 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -5,7 +5,7 @@
 #include "copy.h"
 #include "gettext.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "attr.h"
 #include "run-command.h"
 #include "quote.h"
index c8c7ebcfa392f674286a39a5d37a1bba292d10a3..8430064000bcba96506e4b9c99c9efe60ba072f4 100644 (file)
@@ -7,7 +7,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "strvec.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "packfile.h"
 #include "parse-options.h"
 #include "write-or-die.h"
diff --git a/diff.c b/diff.c
index d02fbf507e5cd6f83e11b1b2bfc5e9df7d809474..6fb2946a6413f8d8546fe1b04b35c6aaf69f0ae9 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -20,7 +20,7 @@
 #include "attr.h"
 #include "run-command.h"
 #include "utf8.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "userdiff.h"
 #include "submodule-config.h"
 #include "submodule.h"
index 8e2e7a3ad738468b1738661ab00627a05d6dd129..926b554bd599a82f03799f5d8030794049ce8036 100644 (file)
@@ -6,7 +6,7 @@
 #include "alloc.h"
 #include "diff.h"
 #include "diffcore.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "hashmap.h"
 #include "mem-pool.h"
 #include "oid-array.h"
diff --git a/dir.c b/dir.c
index 3cf3d428c7ba8816412194876a8a4861d08402a1..fada2713b9e8ff24a38ce77d058f5cd9d5b9739f 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -15,7 +15,7 @@
 #include "gettext.h"
 #include "name-hash.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "attr.h"
 #include "refs.h"
diff --git a/entry.c b/entry.c
index 041f5cf212dfc4b9e45d28e8cb765e19d670e56f..f9a7c726a4dd33f1a184f3a52a9b3aa4edb0c101 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "blob.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "dir.h"
 #include "environment.h"
 #include "gettext.h"
index 5c494777a69f7388c45fe7e19a1b59ebb32809b1..821d458c92adaa663b71db3f4cab21fd37b4ec4d 100644 (file)
@@ -20,7 +20,7 @@
 #include "commit.h"
 #include "strvec.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "replace-object.h"
 #include "tmp-objdir.h"
index 207548b3e5a98f5c232f149b7fb3b48201a768a8..a432eacab999a87fb3c3d545d90dbff82e57a820 100644 (file)
@@ -24,7 +24,7 @@
 #include "oid-array.h"
 #include "oidset.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "connected.h"
 #include "fetch-negotiator.h"
index f096b1ef549d8ebde27759135dfabb4b0120a158..4da6c7a8bdab864dc19304ea1e660a807867182c 100644 (file)
@@ -4,7 +4,7 @@
 #include "environment.h"
 #include "refs.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "diff.h"
 #include "diff-merges.h"
 #include "hex.h"
diff --git a/fsck.c b/fsck.c
index 04e729953b2cbf58ce29fa9b96933d51b7b74981..a219d6f2c0ac087b50376944b6a08e235b7523b2 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -1,8 +1,9 @@
 #include "git-compat-util.h"
 #include "alloc.h"
 #include "date.h"
+#include "dir.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "repository.h"
 #include "object.h"
diff --git a/grep.c b/grep.c
index f00986c451a99502a9dbe5bc1feeca6c486f0065..ebcd647478838582f75910b686045a329f704b9a 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -3,7 +3,7 @@
 #include "gettext.h"
 #include "grep.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pretty.h"
 #include "userdiff.h"
 #include "xdiff-interface.h"
index ddb9549ecbcd97cb80a27bc5f9ace1bd67d9ea69..e1969c05dc658ed78274f3616df72c8d5bd2bfd5 100644 (file)
@@ -16,7 +16,7 @@
 #include "url.h"
 #include "strvec.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "protocol.h"
 #include "date.h"
 #include "wrapper.h"
index 29cf9db34e35fed836fd7d4b4096a0050630d8a9..9ab2383d2b4a6c312935cbe0687872a3d1d719a5 100644 (file)
@@ -18,7 +18,7 @@
 #include "tree.h"
 #include "tree-walk.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit-reach.h"
 
 #ifdef EXPAT_NEEDS_XMLPARSE_H
index bba306b2d5e18b94aaa41e8fdce30321034feaea..78d99f7c4b002cb95196800a62a1de8fbcce6cea 100644 (file)
@@ -7,7 +7,7 @@
 #include "list.h"
 #include "transport.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 struct alt_base {
        char *base;
diff --git a/http.c b/http.c
index bb58bb3e6a3a47163b911d8276f5c185eada003b..25e4c8a1ae9018a460f36a791570c4ed3de7d5f9 100644 (file)
--- a/http.c
+++ b/http.c
@@ -18,7 +18,7 @@
 #include "protocol.h"
 #include "string-list.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
 static int trace_curl_data = 1;
index 5d270ce59877e297298258e89762a75146518edd..e075a66c99d9f705bd0ca8ccaf9c79c1ca4448fd 100644 (file)
@@ -16,7 +16,7 @@
 #include "oidmap.h"
 #include "oidset.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 /* Remember to update object flag allocation in object.h */
 /*
index eecca721ac0826ef09071e6c3119a231d693771a..672a4cd529851cf70d02b553ca4046af55219d09 100644 (file)
@@ -12,7 +12,7 @@
 #include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "trace.h"
 
 struct traversal_context {
index 60b61597c4249373cff6f2c73c09491656cffbd6..f807e286c88eb43aca5d2e942788f7b937ad507e 100644 (file)
@@ -5,7 +5,7 @@
 #include "environment.h"
 #include "hex.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "repository.h"
 #include "tmp-objdir.h"
 #include "commit.h"
index 5dc5223c430949030d0ceb5aa8a29c6d7e6c02aa..3d6a5e9400f4c8195d0f58ab58f3f9a4dfa0acba 100644 (file)
--- a/mailmap.c
+++ b/mailmap.c
@@ -3,7 +3,7 @@
 #include "string-list.h"
 #include "mailmap.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "setup.h"
 
 const char *git_mailmap_file;
index 6bc8eb76477b75e3b8ed32a1f9770e27f235e80f..0885ac681cd5055f80fb5088b04c92eed8e7f291 100644 (file)
@@ -1,9 +1,10 @@
 #include "git-compat-util.h"
 #include "hex.h"
 #include "match-trees.h"
+#include "strbuf.h"
 #include "tree.h"
 #include "tree-walk.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 static int score_missing(unsigned mode)
 {
index 40c48e3eba62cf791578302cbb2992b6076522cd..9293cbf75c8ab737a2cf7267d3e31ffd93a48dc8 100644 (file)
@@ -4,7 +4,7 @@
 #include "merge-ll.h"
 #include "blob.h"
 #include "merge-blobs.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
 {
index d88178dddf69416216f911c801f35c29d2011dc2..8631c997002dbbdb1282619c77cc3ac8fd96f880 100644 (file)
@@ -34,7 +34,7 @@
 #include "match-trees.h"
 #include "mem-pool.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oid-array.h"
 #include "path.h"
 #include "promisor-remote.h"
index 35e1e7e1befd32f602f95258ee1bcc7ead6115a0..43f6b2d0364dbf382b528a9b2a9bd55eb8e742a3 100644 (file)
@@ -26,7 +26,7 @@
 #include "name-hash.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "repository.h"
 #include "revision.h"
diff --git a/midx.c b/midx.c
index b500174d1f3d1a895463a13fb59850eb2f1b88f5..db459e448b744fcaf8a60688e884617d0d03620e 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -9,7 +9,7 @@
 #include "lockfile.h"
 #include "packfile.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "hash-lookup.h"
 #include "midx.h"
 #include "progress.h"
index 14288caf98f83ca27759e6061080fd9cf791e017..0e1d5b1ac7a48d9bda8f76091a55be7c527e68cc 100644 (file)
@@ -1,10 +1,11 @@
 #include "git-compat-util.h"
 #include "notes-cache.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pretty.h"
 #include "repository.h"
 #include "commit.h"
 #include "refs.h"
+#include "strbuf.h"
 
 static int notes_cache_match_validity(struct repository *r,
                                      const char *ref,
index 4be11a01550946f3efe77b2da3eab123ab95a195..071947894edb0726e8577cf9a6619187361713fb 100644 (file)
@@ -5,7 +5,7 @@
 #include "refs.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "repository.h"
 #include "diff.h"
diff --git a/notes.c b/notes.c
index f51a2d3630e4336b0f8fd264e5f637e2f2a105c1..503dbc4be18a16180394de422692c16f90da7a8c 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -4,7 +4,7 @@
 #include "hex.h"
 #include "notes.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "blob.h"
 #include "tree.h"
 #include "utf8.h"
index 45f4d51305bdd2f500ac39f95c846c2e8c005fac..7e96c97051e22bc2837148f4ac37d4a702a1b81a 100644 (file)
@@ -17,7 +17,7 @@
 #include "oidtree.h"
 #include "packfile.h"
 #include "pretty.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "read-cache-ll.h"
 #include "repository.h"
 #include "setup.h"
diff --git a/object-store-ll.h b/object-store-ll.h
new file mode 100644 (file)
index 0000000..e8f22cd
--- /dev/null
@@ -0,0 +1,533 @@
+#ifndef OBJECT_STORE_LL_H
+#define OBJECT_STORE_LL_H
+
+#include "hashmap.h"
+#include "object.h"
+#include "list.h"
+#include "thread-utils.h"
+#include "oidset.h"
+
+struct oidmap;
+struct oidtree;
+struct strbuf;
+
+struct object_directory {
+       struct object_directory *next;
+
+       /*
+        * Used to store the results of readdir(3) calls when we are OK
+        * sacrificing accuracy due to races for speed. That includes
+        * object existence with OBJECT_INFO_QUICK, as well as
+        * our search for unique abbreviated hashes. Don't use it for tasks
+        * requiring greater accuracy!
+        *
+        * Be sure to call odb_load_loose_cache() before using.
+        */
+       uint32_t loose_objects_subdir_seen[8]; /* 256 bits */
+       struct oidtree *loose_objects_cache;
+
+       /*
+        * This is a temporary object store created by the tmp_objdir
+        * facility. Disable ref updates since the objects in the store
+        * might be discarded on rollback.
+        */
+       int disable_ref_updates;
+
+       /*
+        * This object store is ephemeral, so there is no need to fsync.
+        */
+       int will_destroy;
+
+       /*
+        * Path to the alternative object store. If this is a relative path,
+        * it is relative to the current working directory.
+        */
+       char *path;
+};
+
+struct input_stream {
+       const void *(*read)(struct input_stream *, unsigned long *len);
+       void *data;
+       int is_finished;
+};
+
+void prepare_alt_odb(struct repository *r);
+int has_alt_odb(struct repository *r);
+char *compute_alternate_path(const char *path, struct strbuf *err);
+struct object_directory *find_odb(struct repository *r, const char *obj_dir);
+typedef int alt_odb_fn(struct object_directory *, void *);
+int foreach_alt_odb(alt_odb_fn, void*);
+typedef void alternate_ref_fn(const struct object_id *oid, void *);
+void for_each_alternate_ref(alternate_ref_fn, void *);
+
+/*
+ * Add the directory to the on-disk alternates file; the new entry will also
+ * take effect in the current process.
+ */
+void add_to_alternates_file(const char *dir);
+
+/*
+ * Add the directory to the in-memory list of alternates (along with any
+ * recursive alternates it points to), but do not modify the on-disk alternates
+ * file.
+ */
+void add_to_alternates_memory(const char *dir);
+
+/*
+ * Replace the current writable object directory with the specified temporary
+ * object directory; returns the former primary object directory.
+ */
+struct object_directory *set_temporary_primary_odb(const char *dir, int will_destroy);
+
+/*
+ * Restore a previous ODB replaced by set_temporary_main_odb.
+ */
+void restore_primary_odb(struct object_directory *restore_odb, const char *old_path);
+
+/*
+ * Populate and return the loose object cache array corresponding to the
+ * given object ID.
+ */
+struct oidtree *odb_loose_cache(struct object_directory *odb,
+                                 const struct object_id *oid);
+
+/* Empty the loose object cache for the specified object directory. */
+void odb_clear_loose_cache(struct object_directory *odb);
+
+/* Clear and free the specified object directory */
+void free_object_directory(struct object_directory *odb);
+
+struct packed_git {
+       struct hashmap_entry packmap_ent;
+       struct packed_git *next;
+       struct list_head mru;
+       struct pack_window *windows;
+       off_t pack_size;
+       const void *index_data;
+       size_t index_size;
+       uint32_t num_objects;
+       uint32_t crc_offset;
+       struct oidset bad_objects;
+       int index_version;
+       time_t mtime;
+       int pack_fd;
+       int index;              /* for builtin/pack-objects.c */
+       unsigned pack_local:1,
+                pack_keep:1,
+                pack_keep_in_core:1,
+                freshened:1,
+                do_not_close:1,
+                pack_promisor:1,
+                multi_pack_index:1,
+                is_cruft:1;
+       unsigned char hash[GIT_MAX_RAWSZ];
+       struct revindex_entry *revindex;
+       const uint32_t *revindex_data;
+       const uint32_t *revindex_map;
+       size_t revindex_size;
+       /*
+        * mtimes_map points at the beginning of the memory mapped region of
+        * this pack's corresponding .mtimes file, and mtimes_size is the size
+        * of that .mtimes file
+        */
+       const uint32_t *mtimes_map;
+       size_t mtimes_size;
+       /* something like ".git/objects/pack/xxxxx.pack" */
+       char pack_name[FLEX_ARRAY]; /* more */
+};
+
+struct multi_pack_index;
+
+static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,
+                                    const struct hashmap_entry *entry,
+                                    const struct hashmap_entry *entry2,
+                                    const void *keydata)
+{
+       const char *key = keydata;
+       const struct packed_git *pg1, *pg2;
+
+       pg1 = container_of(entry, const struct packed_git, packmap_ent);
+       pg2 = container_of(entry2, const struct packed_git, packmap_ent);
+
+       return strcmp(pg1->pack_name, key ? key : pg2->pack_name);
+}
+
+struct raw_object_store {
+       /*
+        * Set of all object directories; the main directory is first (and
+        * cannot be NULL after initialization). Subsequent directories are
+        * alternates.
+        */
+       struct object_directory *odb;
+       struct object_directory **odb_tail;
+       struct kh_odb_path_map *odb_by_path;
+
+       int loaded_alternates;
+
+       /*
+        * A list of alternate object directories loaded from the environment;
+        * this should not generally need to be accessed directly, but will
+        * populate the "odb" list when prepare_alt_odb() is run.
+        */
+       char *alternate_db;
+
+       /*
+        * Objects that should be substituted by other objects
+        * (see git-replace(1)).
+        */
+       struct oidmap *replace_map;
+       unsigned replace_map_initialized : 1;
+       pthread_mutex_t replace_mutex; /* protect object replace functions */
+
+       struct commit_graph *commit_graph;
+       unsigned commit_graph_attempted : 1; /* if loading has been attempted */
+
+       /*
+        * private data
+        *
+        * should only be accessed directly by packfile.c and midx.c
+        */
+       struct multi_pack_index *multi_pack_index;
+
+       /*
+        * private data
+        *
+        * should only be accessed directly by packfile.c
+        */
+
+       struct packed_git *packed_git;
+       /* A most-recently-used ordered version of the packed_git list. */
+       struct list_head packed_git_mru;
+
+       struct {
+               struct packed_git **packs;
+               unsigned flags;
+       } kept_pack_cache;
+
+       /*
+        * A map of packfiles to packed_git structs for tracking which
+        * packs have been loaded already.
+        */
+       struct hashmap pack_map;
+
+       /*
+        * A fast, rough count of the number of objects in the repository.
+        * These two fields are not meant for direct access. Use
+        * repo_approximate_object_count() instead.
+        */
+       unsigned long approximate_object_count;
+       unsigned approximate_object_count_valid : 1;
+
+       /*
+        * Whether packed_git has already been populated with this repository's
+        * packs.
+        */
+       unsigned packed_git_initialized : 1;
+};
+
+struct raw_object_store *raw_object_store_new(void);
+void raw_object_store_clear(struct raw_object_store *o);
+
+/*
+ * Put in `buf` the name of the file in the local object database that
+ * would be used to store a loose object with the specified oid.
+ */
+const char *loose_object_path(struct repository *r, struct strbuf *buf,
+                             const struct object_id *oid);
+
+void *map_loose_object(struct repository *r, const struct object_id *oid,
+                      unsigned long *size);
+
+void *repo_read_object_file(struct repository *r,
+                           const struct object_id *oid,
+                           enum object_type *type,
+                           unsigned long *size);
+
+/* Read and unpack an object file into memory, write memory to an object file */
+int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
+
+void hash_object_file(const struct git_hash_algo *algo, const void *buf,
+                     unsigned long len, enum object_type type,
+                     struct object_id *oid);
+
+int write_object_file_flags(const void *buf, unsigned long len,
+                           enum object_type type, struct object_id *oid,
+                           unsigned flags);
+static inline int write_object_file(const void *buf, unsigned long len,
+                                   enum object_type type, struct object_id *oid)
+{
+       return write_object_file_flags(buf, len, type, oid, 0);
+}
+
+int write_object_file_literally(const void *buf, unsigned long len,
+                               const char *type, struct object_id *oid,
+                               unsigned flags);
+int stream_loose_object(struct input_stream *in_stream, size_t len,
+                       struct object_id *oid);
+
+/*
+ * Add an object file to the in-memory object store, without writing it
+ * to disk.
+ *
+ * Callers are responsible for calling write_object_file to record the
+ * object in persistent storage before writing any other new objects
+ * that reference it.
+ */
+int pretend_object_file(void *, unsigned long, enum object_type,
+                       struct object_id *oid);
+
+int force_object_loose(const struct object_id *oid, time_t mtime);
+
+struct object_info {
+       /* Request */
+       enum object_type *typep;
+       unsigned long *sizep;
+       off_t *disk_sizep;
+       struct object_id *delta_base_oid;
+       struct strbuf *type_name;
+       void **contentp;
+
+       /* Response */
+       enum {
+               OI_CACHED,
+               OI_LOOSE,
+               OI_PACKED,
+               OI_DBCACHED
+       } whence;
+       union {
+               /*
+                * struct {
+                *      ... Nothing to expose in this case
+                * } cached;
+                * struct {
+                *      ... Nothing to expose in this case
+                * } loose;
+                */
+               struct {
+                       struct packed_git *pack;
+                       off_t offset;
+                       unsigned int is_delta;
+               } packed;
+       } u;
+};
+
+/*
+ * Initializer for a "struct object_info" that wants no items. You may
+ * also memset() the memory to all-zeroes.
+ */
+#define OBJECT_INFO_INIT { 0 }
+
+/* Invoke lookup_replace_object() on the given hash */
+#define OBJECT_INFO_LOOKUP_REPLACE 1
+/* Allow reading from a loose object file of unknown/bogus type */
+#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2
+/* Do not retry packed storage after checking packed and loose storage */
+#define OBJECT_INFO_QUICK 8
+/*
+ * Do not attempt to fetch the object if missing (even if fetch_is_missing is
+ * nonzero).
+ */
+#define OBJECT_INFO_SKIP_FETCH_OBJECT 16
+/*
+ * This is meant for bulk prefetching of missing blobs in a partial
+ * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK
+ */
+#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK)
+
+/* Die if object corruption (not just an object being missing) was detected. */
+#define OBJECT_INFO_DIE_IF_CORRUPT 32
+
+int oid_object_info_extended(struct repository *r,
+                            const struct object_id *,
+                            struct object_info *, unsigned flags);
+
+/*
+ * Open the loose object at path, check its hash, and return the contents,
+ * use the "oi" argument to assert things about the object, or e.g. populate its
+ * type, and size. If the object is a blob, then "contents" may return NULL,
+ * to allow streaming of large blobs.
+ *
+ * Returns 0 on success, negative on error (details may be written to stderr).
+ */
+int read_loose_object(const char *path,
+                     const struct object_id *expected_oid,
+                     struct object_id *real_oid,
+                     void **contents,
+                     struct object_info *oi);
+
+/* Retry packed storage after checking packed and loose storage */
+#define HAS_OBJECT_RECHECK_PACKED 1
+
+/*
+ * Returns 1 if the object exists. This function will not lazily fetch objects
+ * in a partial clone.
+ */
+int has_object(struct repository *r, const struct object_id *oid,
+              unsigned flags);
+
+/*
+ * These macros and functions are deprecated. If checking existence for an
+ * object that is likely to be missing and/or whose absence is relatively
+ * inconsequential (or is consequential but the caller is prepared to handle
+ * it), use has_object(), which has better defaults (no lazy fetch in a partial
+ * clone and no rechecking of packed storage). In the unlikely event that a
+ * caller needs to assert existence of an object that it fully expects to
+ * exist, and wants to trigger a lazy fetch in a partial clone, use
+ * oid_object_info_extended() with a NULL struct object_info.
+ *
+ * These functions can be removed once all callers have migrated to
+ * has_object() and/or oid_object_info_extended().
+ */
+int repo_has_object_file(struct repository *r, const struct object_id *oid);
+int repo_has_object_file_with_flags(struct repository *r,
+                                   const struct object_id *oid, int flags);
+
+/*
+ * Return true iff an alternate object database has a loose object
+ * with the specified name.  This function does not respect replace
+ * references.
+ */
+int has_loose_object_nonlocal(const struct object_id *);
+
+int has_loose_object(const struct object_id *);
+
+/**
+ * format_object_header() is a thin wrapper around s xsnprintf() that
+ * writes the initial "<type> <obj-len>" part of the loose object
+ * header. It returns the size that snprintf() returns + 1.
+ */
+int format_object_header(char *str, size_t size, enum object_type type,
+                        size_t objsize);
+
+void assert_oid_type(const struct object_id *oid, enum object_type expect);
+
+/*
+ * Enabling the object read lock allows multiple threads to safely call the
+ * following functions in parallel: repo_read_object_file(),
+ * read_object_with_reference(), oid_object_info() and oid_object_info_extended().
+ *
+ * obj_read_lock() and obj_read_unlock() may also be used to protect other
+ * section which cannot execute in parallel with object reading. Since the used
+ * lock is a recursive mutex, these sections can even contain calls to object
+ * reading functions. However, beware that in these cases zlib inflation won't
+ * be performed in parallel, losing performance.
+ *
+ * TODO: oid_object_info_extended()'s call stack has a recursive behavior. If
+ * any of its callees end up calling it, this recursive call won't benefit from
+ * parallel inflation.
+ */
+void enable_obj_read_lock(void);
+void disable_obj_read_lock(void);
+
+extern int obj_read_use_lock;
+extern pthread_mutex_t obj_read_mutex;
+
+static inline void obj_read_lock(void)
+{
+       if(obj_read_use_lock)
+               pthread_mutex_lock(&obj_read_mutex);
+}
+
+static inline void obj_read_unlock(void)
+{
+       if(obj_read_use_lock)
+               pthread_mutex_unlock(&obj_read_mutex);
+}
+
+/*
+ * Iterate over the files in the loose-object parts of the object
+ * directory "path", triggering the following callbacks:
+ *
+ *  - loose_object is called for each loose object we find.
+ *
+ *  - loose_cruft is called for any files that do not appear to be
+ *    loose objects. Note that we only look in the loose object
+ *    directories "objects/[0-9a-f]{2}/", so we will not report
+ *    "objects/foobar" as cruft.
+ *
+ *  - loose_subdir is called for each top-level hashed subdirectory
+ *    of the object directory (e.g., "$OBJDIR/f0"). It is called
+ *    after the objects in the directory are processed.
+ *
+ * Any callback that is NULL will be ignored. Callbacks returning non-zero
+ * will end the iteration.
+ *
+ * In the "buf" variant, "path" is a strbuf which will also be used as a
+ * scratch buffer, but restored to its original contents before
+ * the function returns.
+ */
+typedef int each_loose_object_fn(const struct object_id *oid,
+                                const char *path,
+                                void *data);
+typedef int each_loose_cruft_fn(const char *basename,
+                               const char *path,
+                               void *data);
+typedef int each_loose_subdir_fn(unsigned int nr,
+                                const char *path,
+                                void *data);
+int for_each_file_in_obj_subdir(unsigned int subdir_nr,
+                               struct strbuf *path,
+                               each_loose_object_fn obj_cb,
+                               each_loose_cruft_fn cruft_cb,
+                               each_loose_subdir_fn subdir_cb,
+                               void *data);
+int for_each_loose_file_in_objdir(const char *path,
+                                 each_loose_object_fn obj_cb,
+                                 each_loose_cruft_fn cruft_cb,
+                                 each_loose_subdir_fn subdir_cb,
+                                 void *data);
+int for_each_loose_file_in_objdir_buf(struct strbuf *path,
+                                     each_loose_object_fn obj_cb,
+                                     each_loose_cruft_fn cruft_cb,
+                                     each_loose_subdir_fn subdir_cb,
+                                     void *data);
+
+/* Flags for for_each_*_object() below. */
+enum for_each_object_flags {
+       /* Iterate only over local objects, not alternates. */
+       FOR_EACH_OBJECT_LOCAL_ONLY = (1<<0),
+
+       /* Only iterate over packs obtained from the promisor remote. */
+       FOR_EACH_OBJECT_PROMISOR_ONLY = (1<<1),
+
+       /*
+        * Visit objects within a pack in packfile order rather than .idx order
+        */
+       FOR_EACH_OBJECT_PACK_ORDER = (1<<2),
+
+       /* Only iterate over packs that are not marked as kept in-core. */
+       FOR_EACH_OBJECT_SKIP_IN_CORE_KEPT_PACKS = (1<<3),
+
+       /* Only iterate over packs that do not have .keep files. */
+       FOR_EACH_OBJECT_SKIP_ON_DISK_KEPT_PACKS = (1<<4),
+};
+
+/*
+ * Iterate over all accessible loose objects without respect to
+ * reachability. By default, this includes both local and alternate objects.
+ * The order in which objects are visited is unspecified.
+ *
+ * Any flags specific to packs are ignored.
+ */
+int for_each_loose_object(each_loose_object_fn, void *,
+                         enum for_each_object_flags flags);
+
+/*
+ * Iterate over all accessible packed objects without respect to reachability.
+ * By default, this includes both local and alternate packs.
+ *
+ * Note that some objects may appear twice if they are found in multiple packs.
+ * Each pack is visited in an unspecified order. By default, objects within a
+ * pack are visited in pack-idx order (i.e., sorted by oid).
+ */
+typedef int each_packed_object_fn(const struct object_id *oid,
+                                 struct packed_git *pack,
+                                 uint32_t pos,
+                                 void *data);
+int for_each_object_in_pack(struct packed_git *p,
+                           each_packed_object_fn, void *data,
+                           enum for_each_object_flags flags);
+int for_each_packed_object(each_packed_object_fn, void *,
+                          enum for_each_object_flags flags);
+
+#endif /* OBJECT_STORE_LL_H */
index 05803a03e922bbf1a8c2b43af42f957a05606e8d..1b3e3d7d0145be18b523ea836aaac3e84c06af4e 100644 (file)
 #ifndef OBJECT_STORE_H
 #define OBJECT_STORE_H
 
-#include "object.h"
-#include "list.h"
-#include "thread-utils.h"
 #include "khash.h"
 #include "dir.h"
-#include "oidset.h"
-
-struct oidmap;
-struct oidtree;
-struct strbuf;
-
-struct object_directory {
-       struct object_directory *next;
-
-       /*
-        * Used to store the results of readdir(3) calls when we are OK
-        * sacrificing accuracy due to races for speed. That includes
-        * object existence with OBJECT_INFO_QUICK, as well as
-        * our search for unique abbreviated hashes. Don't use it for tasks
-        * requiring greater accuracy!
-        *
-        * Be sure to call odb_load_loose_cache() before using.
-        */
-       uint32_t loose_objects_subdir_seen[8]; /* 256 bits */
-       struct oidtree *loose_objects_cache;
-
-       /*
-        * This is a temporary object store created by the tmp_objdir
-        * facility. Disable ref updates since the objects in the store
-        * might be discarded on rollback.
-        */
-       int disable_ref_updates;
-
-       /*
-        * This object store is ephemeral, so there is no need to fsync.
-        */
-       int will_destroy;
-
-       /*
-        * Path to the alternative object store. If this is a relative path,
-        * it is relative to the current working directory.
-        */
-       char *path;
-};
-
-struct input_stream {
-       const void *(*read)(struct input_stream *, unsigned long *len);
-       void *data;
-       int is_finished;
-};
+#include "object-store-ll.h"
 
 KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
        struct object_directory *, 1, fspathhash, fspatheq)
 
-void prepare_alt_odb(struct repository *r);
-int has_alt_odb(struct repository *r);
-char *compute_alternate_path(const char *path, struct strbuf *err);
-struct object_directory *find_odb(struct repository *r, const char *obj_dir);
-typedef int alt_odb_fn(struct object_directory *, void *);
-int foreach_alt_odb(alt_odb_fn, void*);
-typedef void alternate_ref_fn(const struct object_id *oid, void *);
-void for_each_alternate_ref(alternate_ref_fn, void *);
-
-/*
- * Add the directory to the on-disk alternates file; the new entry will also
- * take effect in the current process.
- */
-void add_to_alternates_file(const char *dir);
-
-/*
- * Add the directory to the in-memory list of alternates (along with any
- * recursive alternates it points to), but do not modify the on-disk alternates
- * file.
- */
-void add_to_alternates_memory(const char *dir);
-
-/*
- * Replace the current writable object directory with the specified temporary
- * object directory; returns the former primary object directory.
- */
-struct object_directory *set_temporary_primary_odb(const char *dir, int will_destroy);
-
-/*
- * Restore a previous ODB replaced by set_temporary_main_odb.
- */
-void restore_primary_odb(struct object_directory *restore_odb, const char *old_path);
-
-/*
- * Populate and return the loose object cache array corresponding to the
- * given object ID.
- */
-struct oidtree *odb_loose_cache(struct object_directory *odb,
-                                 const struct object_id *oid);
-
-/* Empty the loose object cache for the specified object directory. */
-void odb_clear_loose_cache(struct object_directory *odb);
-
-/* Clear and free the specified object directory */
-void free_object_directory(struct object_directory *odb);
-
-struct packed_git {
-       struct hashmap_entry packmap_ent;
-       struct packed_git *next;
-       struct list_head mru;
-       struct pack_window *windows;
-       off_t pack_size;
-       const void *index_data;
-       size_t index_size;
-       uint32_t num_objects;
-       uint32_t crc_offset;
-       struct oidset bad_objects;
-       int index_version;
-       time_t mtime;
-       int pack_fd;
-       int index;              /* for builtin/pack-objects.c */
-       unsigned pack_local:1,
-                pack_keep:1,
-                pack_keep_in_core:1,
-                freshened:1,
-                do_not_close:1,
-                pack_promisor:1,
-                multi_pack_index:1,
-                is_cruft:1;
-       unsigned char hash[GIT_MAX_RAWSZ];
-       struct revindex_entry *revindex;
-       const uint32_t *revindex_data;
-       const uint32_t *revindex_map;
-       size_t revindex_size;
-       /*
-        * mtimes_map points at the beginning of the memory mapped region of
-        * this pack's corresponding .mtimes file, and mtimes_size is the size
-        * of that .mtimes file
-        */
-       const uint32_t *mtimes_map;
-       size_t mtimes_size;
-       /* something like ".git/objects/pack/xxxxx.pack" */
-       char pack_name[FLEX_ARRAY]; /* more */
-};
-
-struct multi_pack_index;
-
-static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,
-                                    const struct hashmap_entry *entry,
-                                    const struct hashmap_entry *entry2,
-                                    const void *keydata)
-{
-       const char *key = keydata;
-       const struct packed_git *pg1, *pg2;
-
-       pg1 = container_of(entry, const struct packed_git, packmap_ent);
-       pg2 = container_of(entry2, const struct packed_git, packmap_ent);
-
-       return strcmp(pg1->pack_name, key ? key : pg2->pack_name);
-}
-
-struct raw_object_store {
-       /*
-        * Set of all object directories; the main directory is first (and
-        * cannot be NULL after initialization). Subsequent directories are
-        * alternates.
-        */
-       struct object_directory *odb;
-       struct object_directory **odb_tail;
-       struct kh_odb_path_map *odb_by_path;
-
-       int loaded_alternates;
-
-       /*
-        * A list of alternate object directories loaded from the environment;
-        * this should not generally need to be accessed directly, but will
-        * populate the "odb" list when prepare_alt_odb() is run.
-        */
-       char *alternate_db;
-
-       /*
-        * Objects that should be substituted by other objects
-        * (see git-replace(1)).
-        */
-       struct oidmap *replace_map;
-       unsigned replace_map_initialized : 1;
-       pthread_mutex_t replace_mutex; /* protect object replace functions */
-
-       struct commit_graph *commit_graph;
-       unsigned commit_graph_attempted : 1; /* if loading has been attempted */
-
-       /*
-        * private data
-        *
-        * should only be accessed directly by packfile.c and midx.c
-        */
-       struct multi_pack_index *multi_pack_index;
-
-       /*
-        * private data
-        *
-        * should only be accessed directly by packfile.c
-        */
-
-       struct packed_git *packed_git;
-       /* A most-recently-used ordered version of the packed_git list. */
-       struct list_head packed_git_mru;
-
-       struct {
-               struct packed_git **packs;
-               unsigned flags;
-       } kept_pack_cache;
-
-       /*
-        * A map of packfiles to packed_git structs for tracking which
-        * packs have been loaded already.
-        */
-       struct hashmap pack_map;
-
-       /*
-        * A fast, rough count of the number of objects in the repository.
-        * These two fields are not meant for direct access. Use
-        * repo_approximate_object_count() instead.
-        */
-       unsigned long approximate_object_count;
-       unsigned approximate_object_count_valid : 1;
-
-       /*
-        * Whether packed_git has already been populated with this repository's
-        * packs.
-        */
-       unsigned packed_git_initialized : 1;
-};
-
-struct raw_object_store *raw_object_store_new(void);
-void raw_object_store_clear(struct raw_object_store *o);
-
-/*
- * Put in `buf` the name of the file in the local object database that
- * would be used to store a loose object with the specified oid.
- */
-const char *loose_object_path(struct repository *r, struct strbuf *buf,
-                             const struct object_id *oid);
-
-void *map_loose_object(struct repository *r, const struct object_id *oid,
-                      unsigned long *size);
-
-void *repo_read_object_file(struct repository *r,
-                           const struct object_id *oid,
-                           enum object_type *type,
-                           unsigned long *size);
-
-/* Read and unpack an object file into memory, write memory to an object file */
-int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
-
-void hash_object_file(const struct git_hash_algo *algo, const void *buf,
-                     unsigned long len, enum object_type type,
-                     struct object_id *oid);
-
-int write_object_file_flags(const void *buf, unsigned long len,
-                           enum object_type type, struct object_id *oid,
-                           unsigned flags);
-static inline int write_object_file(const void *buf, unsigned long len,
-                                   enum object_type type, struct object_id *oid)
-{
-       return write_object_file_flags(buf, len, type, oid, 0);
-}
-
-int write_object_file_literally(const void *buf, unsigned long len,
-                               const char *type, struct object_id *oid,
-                               unsigned flags);
-int stream_loose_object(struct input_stream *in_stream, size_t len,
-                       struct object_id *oid);
-
-/*
- * Add an object file to the in-memory object store, without writing it
- * to disk.
- *
- * Callers are responsible for calling write_object_file to record the
- * object in persistent storage before writing any other new objects
- * that reference it.
- */
-int pretend_object_file(void *, unsigned long, enum object_type,
-                       struct object_id *oid);
-
-int force_object_loose(const struct object_id *oid, time_t mtime);
-
-struct object_info {
-       /* Request */
-       enum object_type *typep;
-       unsigned long *sizep;
-       off_t *disk_sizep;
-       struct object_id *delta_base_oid;
-       struct strbuf *type_name;
-       void **contentp;
-
-       /* Response */
-       enum {
-               OI_CACHED,
-               OI_LOOSE,
-               OI_PACKED,
-               OI_DBCACHED
-       } whence;
-       union {
-               /*
-                * struct {
-                *      ... Nothing to expose in this case
-                * } cached;
-                * struct {
-                *      ... Nothing to expose in this case
-                * } loose;
-                */
-               struct {
-                       struct packed_git *pack;
-                       off_t offset;
-                       unsigned int is_delta;
-               } packed;
-       } u;
-};
-
-/*
- * Initializer for a "struct object_info" that wants no items. You may
- * also memset() the memory to all-zeroes.
- */
-#define OBJECT_INFO_INIT { 0 }
-
-/* Invoke lookup_replace_object() on the given hash */
-#define OBJECT_INFO_LOOKUP_REPLACE 1
-/* Allow reading from a loose object file of unknown/bogus type */
-#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2
-/* Do not retry packed storage after checking packed and loose storage */
-#define OBJECT_INFO_QUICK 8
-/*
- * Do not attempt to fetch the object if missing (even if fetch_is_missing is
- * nonzero).
- */
-#define OBJECT_INFO_SKIP_FETCH_OBJECT 16
-/*
- * This is meant for bulk prefetching of missing blobs in a partial
- * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK
- */
-#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK)
-
-/* Die if object corruption (not just an object being missing) was detected. */
-#define OBJECT_INFO_DIE_IF_CORRUPT 32
-
-int oid_object_info_extended(struct repository *r,
-                            const struct object_id *,
-                            struct object_info *, unsigned flags);
-
-/*
- * Open the loose object at path, check its hash, and return the contents,
- * use the "oi" argument to assert things about the object, or e.g. populate its
- * type, and size. If the object is a blob, then "contents" may return NULL,
- * to allow streaming of large blobs.
- *
- * Returns 0 on success, negative on error (details may be written to stderr).
- */
-int read_loose_object(const char *path,
-                     const struct object_id *expected_oid,
-                     struct object_id *real_oid,
-                     void **contents,
-                     struct object_info *oi);
-
-/* Retry packed storage after checking packed and loose storage */
-#define HAS_OBJECT_RECHECK_PACKED 1
-
-/*
- * Returns 1 if the object exists. This function will not lazily fetch objects
- * in a partial clone.
- */
-int has_object(struct repository *r, const struct object_id *oid,
-              unsigned flags);
-
-/*
- * These macros and functions are deprecated. If checking existence for an
- * object that is likely to be missing and/or whose absence is relatively
- * inconsequential (or is consequential but the caller is prepared to handle
- * it), use has_object(), which has better defaults (no lazy fetch in a partial
- * clone and no rechecking of packed storage). In the unlikely event that a
- * caller needs to assert existence of an object that it fully expects to
- * exist, and wants to trigger a lazy fetch in a partial clone, use
- * oid_object_info_extended() with a NULL struct object_info.
- *
- * These functions can be removed once all callers have migrated to
- * has_object() and/or oid_object_info_extended().
- */
-int repo_has_object_file(struct repository *r, const struct object_id *oid);
-int repo_has_object_file_with_flags(struct repository *r,
-                                   const struct object_id *oid, int flags);
-
-/*
- * Return true iff an alternate object database has a loose object
- * with the specified name.  This function does not respect replace
- * references.
- */
-int has_loose_object_nonlocal(const struct object_id *);
-
-int has_loose_object(const struct object_id *);
-
-/**
- * format_object_header() is a thin wrapper around s xsnprintf() that
- * writes the initial "<type> <obj-len>" part of the loose object
- * header. It returns the size that snprintf() returns + 1.
- */
-int format_object_header(char *str, size_t size, enum object_type type,
-                        size_t objsize);
-
-void assert_oid_type(const struct object_id *oid, enum object_type expect);
-
-/*
- * Enabling the object read lock allows multiple threads to safely call the
- * following functions in parallel: repo_read_object_file(),
- * read_object_with_reference(), oid_object_info() and oid_object_info_extended().
- *
- * obj_read_lock() and obj_read_unlock() may also be used to protect other
- * section which cannot execute in parallel with object reading. Since the used
- * lock is a recursive mutex, these sections can even contain calls to object
- * reading functions. However, beware that in these cases zlib inflation won't
- * be performed in parallel, losing performance.
- *
- * TODO: oid_object_info_extended()'s call stack has a recursive behavior. If
- * any of its callees end up calling it, this recursive call won't benefit from
- * parallel inflation.
- */
-void enable_obj_read_lock(void);
-void disable_obj_read_lock(void);
-
-extern int obj_read_use_lock;
-extern pthread_mutex_t obj_read_mutex;
-
-static inline void obj_read_lock(void)
-{
-       if(obj_read_use_lock)
-               pthread_mutex_lock(&obj_read_mutex);
-}
-
-static inline void obj_read_unlock(void)
-{
-       if(obj_read_use_lock)
-               pthread_mutex_unlock(&obj_read_mutex);
-}
-
-/*
- * Iterate over the files in the loose-object parts of the object
- * directory "path", triggering the following callbacks:
- *
- *  - loose_object is called for each loose object we find.
- *
- *  - loose_cruft is called for any files that do not appear to be
- *    loose objects. Note that we only look in the loose object
- *    directories "objects/[0-9a-f]{2}/", so we will not report
- *    "objects/foobar" as cruft.
- *
- *  - loose_subdir is called for each top-level hashed subdirectory
- *    of the object directory (e.g., "$OBJDIR/f0"). It is called
- *    after the objects in the directory are processed.
- *
- * Any callback that is NULL will be ignored. Callbacks returning non-zero
- * will end the iteration.
- *
- * In the "buf" variant, "path" is a strbuf which will also be used as a
- * scratch buffer, but restored to its original contents before
- * the function returns.
- */
-typedef int each_loose_object_fn(const struct object_id *oid,
-                                const char *path,
-                                void *data);
-typedef int each_loose_cruft_fn(const char *basename,
-                               const char *path,
-                               void *data);
-typedef int each_loose_subdir_fn(unsigned int nr,
-                                const char *path,
-                                void *data);
-int for_each_file_in_obj_subdir(unsigned int subdir_nr,
-                               struct strbuf *path,
-                               each_loose_object_fn obj_cb,
-                               each_loose_cruft_fn cruft_cb,
-                               each_loose_subdir_fn subdir_cb,
-                               void *data);
-int for_each_loose_file_in_objdir(const char *path,
-                                 each_loose_object_fn obj_cb,
-                                 each_loose_cruft_fn cruft_cb,
-                                 each_loose_subdir_fn subdir_cb,
-                                 void *data);
-int for_each_loose_file_in_objdir_buf(struct strbuf *path,
-                                     each_loose_object_fn obj_cb,
-                                     each_loose_cruft_fn cruft_cb,
-                                     each_loose_subdir_fn subdir_cb,
-                                     void *data);
-
-/* Flags for for_each_*_object() below. */
-enum for_each_object_flags {
-       /* Iterate only over local objects, not alternates. */
-       FOR_EACH_OBJECT_LOCAL_ONLY = (1<<0),
-
-       /* Only iterate over packs obtained from the promisor remote. */
-       FOR_EACH_OBJECT_PROMISOR_ONLY = (1<<1),
-
-       /*
-        * Visit objects within a pack in packfile order rather than .idx order
-        */
-       FOR_EACH_OBJECT_PACK_ORDER = (1<<2),
-
-       /* Only iterate over packs that are not marked as kept in-core. */
-       FOR_EACH_OBJECT_SKIP_IN_CORE_KEPT_PACKS = (1<<3),
-
-       /* Only iterate over packs that do not have .keep files. */
-       FOR_EACH_OBJECT_SKIP_ON_DISK_KEPT_PACKS = (1<<4),
-};
-
-/*
- * Iterate over all accessible loose objects without respect to
- * reachability. By default, this includes both local and alternate objects.
- * The order in which objects are visited is unspecified.
- *
- * Any flags specific to packs are ignored.
- */
-int for_each_loose_object(each_loose_object_fn, void *,
-                         enum for_each_object_flags flags);
-
-/*
- * Iterate over all accessible packed objects without respect to reachability.
- * By default, this includes both local and alternate packs.
- *
- * Note that some objects may appear twice if they are found in multiple packs.
- * Each pack is visited in an unspecified order. By default, objects within a
- * pack are visited in pack-idx order (i.e., sorted by oid).
- */
-typedef int each_packed_object_fn(const struct object_id *oid,
-                                 struct packed_git *pack,
-                                 uint32_t pos,
-                                 void *data);
-int for_each_object_in_pack(struct packed_git *p,
-                           each_packed_object_fn, void *data,
-                           enum for_each_object_flags flags);
-int for_each_packed_object(each_packed_object_fn, void *,
-                          enum for_each_object_flags flags);
-
 #endif /* OBJECT_STORE_H */
index 609a343ee3ea41e6c4f18f0d07a104922dc952f2..3e190214d1487e4bd1f04315698e0f041402648e 100644 (file)
@@ -1,5 +1,5 @@
 #include "git-compat-util.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "packfile.h"
 
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
index 623ee2a8197389fda9a5c253769aadfe24dc36f7..d86f4e739a4b342374cdc97b607a1ed89d74bfa9 100644 (file)
@@ -3,7 +3,7 @@
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit.h"
 #include "tag.h"
 #include "diff.h"
index 999f962602da7d1aae2e90cb620c0ffb42a7f510..576e613837eb85080f552129e77a52f4b9b5204f 100644 (file)
@@ -17,7 +17,7 @@
 #include "repository.h"
 #include "trace2.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "list-objects-filter-options.h"
 #include "midx.h"
 #include "config.h"
index 049f2f0bfc03f2c08a4e24fa6be767f01fe8145d..977f619618e0a9b97044f0b07e5617d3b3e1839b 100644 (file)
@@ -7,7 +7,7 @@
 #include "progress.h"
 #include "packfile.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 struct idx_entry {
        off_t                offset;
index 020a37f8fe3a837de959ceade8dca86849253593..cdf30b8d2b0e809db7ee7e219b39863fad702bd4 100644 (file)
@@ -2,8 +2,9 @@
 #include "gettext.h"
 #include "pack-mtimes.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "packfile.h"
+#include "strbuf.h"
 
 static char *pack_mtimes_filename(struct packed_git *p)
 {
index 579476687c4f7123c7861cde595a1ce94f87ae1f..0d78db40cb2f11fcbc4b3c2bbb2d23624ef3f22e 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PACK_OBJECTS_H
 #define PACK_OBJECTS_H
 
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "thread-utils.h"
 #include "pack.h"
 
index 1f51b712e879e401e9b308d993a2b810460f01e3..7fffcad9125610cb05a5823b03b86d3e28eeabdb 100644 (file)
@@ -2,8 +2,9 @@
 #include "gettext.h"
 #include "pack-revindex.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "packfile.h"
+#include "strbuf.h"
 #include "trace2.h"
 #include "config.h"
 #include "midx.h"
index 45681e2d7db28eb147d7df7e3b4ae83839580158..af48813a9bbd9b9742e65ec6d5678a03aedcb361 100644 (file)
@@ -11,6 +11,7 @@
 #include "pack-objects.h"
 #include "pack-revindex.h"
 #include "path.h"
+#include "strbuf.h"
 #include "wrapper.h"
 
 void reset_pack_idx_option(struct pack_idx_option *opts)
index fd083c86e00c1dbb1de6ba994f2df50e15797002..c60aeb05ececa839d38e1c01227d6b11c08177de 100644 (file)
@@ -19,7 +19,7 @@
 #include "tree-walk.h"
 #include "tree.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "midx.h"
 #include "commit-graph.h"
 #include "pack-revindex.h"
diff --git a/path.c b/path.c
index 7c1cd8182a81b9e8892960707cff8a0f7ff174cb..c3b6618c77ba46cbb996a24383c41089dfcc40d4 100644 (file)
--- a/path.c
+++ b/path.c
@@ -15,7 +15,7 @@
 #include "submodule-config.h"
 #include "path.h"
 #include "packfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "lockfile.h"
 #include "exec-cmd.h"
 #include "wrapper.h"
index 1adcd6fb0a51a0abc5c93a1fe3fc26dc51d60ab8..db88d2064d4c3bf2f3cf3c7384aafeb815cbf3c0 100644 (file)
@@ -1,7 +1,7 @@
 #include "git-compat-util.h"
 #include "gettext.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "promisor-remote.h"
 #include "config.h"
 #include "trace2.h"
index a90c48852e58f8c0898d1ab7e337356fb39731f7..808a68c974ab7715513657c62d238aae8d3af07f 100644 (file)
@@ -7,7 +7,7 @@
 #include "hash-ll.h"
 #include "hex.h"
 #include "object.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "string-list.h"
 #include "strbuf.h"
 
index 58412b4fb9157f6ef5d3bf6dde7b890e500b741f..e54daf740a26345a182eb67d7ab2716916e41c37 100644 (file)
@@ -1,7 +1,7 @@
 #include "git-compat-util.h"
 #include "environment.h"
 #include "gettext.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "packfile.h"
 #include "progress.h"
 #include "prune-packed.h"
index 55bb1143530fceb53f4f68450ecb455861cbbe2d..434f09e9ebf115f5b2bb5d71f49407744bcb1a78 100644 (file)
@@ -13,7 +13,7 @@
 #include "list-objects.h"
 #include "packfile.h"
 #include "worktree.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pack-bitmap.h"
 #include "pack-mtimes.h"
 
index 86ada403a839245e452e93d29bd6fbf74c9b93d0..b9a995e5a18d4a1b7b71d15bf490054b12588758 100644 (file)
@@ -17,7 +17,7 @@
 #include "refs.h"
 #include "dir.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oid-array.h"
 #include "tree.h"
 #include "commit.h"
index 4991cd4f7a860be1cf508e88668d1fd8af2ff9ae..e0d03a9f8e9f17124300557dba791d5c823f5a43 100644 (file)
@@ -8,7 +8,7 @@
 #include "refs.h"
 #include "wildmatch.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oid-array.h"
 #include "repository.h"
 #include "commit.h"
index ee1bf5d032c823292a9a57853caf0a9be5ea9bab..9ad50e7d93e40c7a5f9c7ad0cecb0b7d1766105b 100644 (file)
--- a/reflog.c
+++ b/reflog.c
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "gettext.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "reflog.h"
 #include "refs.h"
 #include "revision.h"
diff --git a/refs.c b/refs.c
index 8b192e4cb46c871c6287d46bb30b8613a5f0d762..c029f64982f2308ebef8e199e9ab926f36d32ae2 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -17,7 +17,7 @@
 #include "run-command.h"
 #include "hook.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "object.h"
 #include "path.h"
 #include "tag.h"
index 8550056db433b3b2b55e6405b283c919321b22d6..6538b6037de5fb2c67f63205ca37ae6ea4f1c390 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -10,7 +10,7 @@
 #include "refs.h"
 #include "refspec.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "commit.h"
 #include "diff.h"
index e98825d5852d80f6799904e4b0280f438375b75a..ca4017635df04fcc1ebfa2699ef464ff2a263958 100644 (file)
@@ -2,7 +2,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "oidmap.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "replace-object.h"
 #include "refs.h"
 #include "repository.h"
index 500482b02b38ce30ee51a005d00ca00e76033f19..a964db1670e9c6011a3f8f243e19bbed68739788 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "oidmap.h"
 #include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 /*
  * Do replace refs need to be checked this run?  This variable is
index 4d685374077adff8a43f2eb00a379104645abee3..a7679ceeaa45ce7a20094f9a29a82987290ad354 100644 (file)
@@ -6,7 +6,7 @@
 #include "git-compat-util.h"
 #include "abspath.h"
 #include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "config.h"
 #include "object.h"
 #include "lockfile.h"
index 3584fecb07c59b22d6742ffb5ddb81c48e03f169..e2b8597f88cd1e24122103cf23f12df34a1ef6f6 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -17,7 +17,7 @@
 #include "path.h"
 #include "pathspec.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "hash-lookup.h"
 #include "strmap.h"
 #include "wrapper.h"
index d4b4b34fd801923fbd863df73ffa1c7cdf4343fb..84768565cefa5253816ab0ca3bf0e03c11bc80b3 100644 (file)
@@ -6,7 +6,7 @@
 #include "hex.h"
 #include "object-name.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "tag.h"
 #include "blob.h"
 #include "tree.h"
index 0c7ccaef6805f1cffd5aa6246c885eb54fd258e5..9510bef8561cc1e0047f2ec6d75795fded4a36df 100644 (file)
@@ -5,7 +5,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "refs.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pkt-line.h"
 #include "sideband.h"
 #include "run-command.h"
index 282a6cff1b73c9c414c83d49f22cfc39eda8c825..8dd5bdeb36426a5c34dc40b9770a4243f62a9dfe 100644 (file)
@@ -11,7 +11,7 @@
 #include "dir.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "object.h"
 #include "pager.h"
 #include "commit.h"
index 85d17bbb15173a022b5394434c59148b430ee926..382e481a2b09b7d71c0ea4b32ad9734d79448af1 100644 (file)
@@ -11,7 +11,7 @@
 #include "packfile.h"
 #include "path.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "server-info.h"
 #include "strbuf.h"
 #include "wrapper.h"
index 45343e6a78b8f9137eae10cdacf9aee67f38a176..f3ef94d4c924672feb3096b440e5170bba7cc0d5 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -4,7 +4,7 @@
 #include "repository.h"
 #include "tempfile.h"
 #include "lockfile.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit.h"
 #include "tag.h"
 #include "pkt-line.h"
index 21e39585e8906e8463c9765c044ecb4399b9603c..49791ab958dc843227b661cdde9b35efa4b1a856 100644 (file)
@@ -7,7 +7,7 @@
 #include "streaming.h"
 #include "repository.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "replace-object.h"
 #include "packfile.h"
 #include "wrapper.h"
index 6786bcee5217c86c666ecdb02e2994368a1e9b27..515ff5bba41c272e90bf9fd1f4681b4c65a16dd7 100644 (file)
@@ -11,7 +11,7 @@
 #include "submodule.h"
 #include "strbuf.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "parse-options.h"
 #include "thread-utils.h"
 #include "tree-walk.h"
index 245300596ffcdb4ea905c3ebabb108a71975b862..f0f8788d2e34a0ee7fe1aa853cf8a7f1890abd6b 100644 (file)
@@ -27,7 +27,7 @@
 #include "parse-options.h"
 #include "object-file.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit-reach.h"
 #include "read-cache-ll.h"
 #include "setup.h"
index 0f3fbeec5325922a83e0d15382b940e6afddcb51..67a964ef9041a061497c0b10698413d360f561e1 100644 (file)
@@ -1,7 +1,7 @@
 #include "test-tool.h"
 #include "hex.h"
 #include "strbuf.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "packfile.h"
 #include "pack-mtimes.h"
 #include "setup.h"
index 362bd64a4c21a632e27a53a4154355803400a9de..910a12861442264ca951a1a2ef27e6fb20eb7985 100644 (file)
@@ -1,7 +1,7 @@
 #include "test-tool.h"
 #include "hex.h"
 #include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "setup.h"
 
 /*
index 3ac496e27e497df4d3ba800409c0117fbb8ded1f..8c7a83f578f41c3d90bcb17628bd5307e5927636 100644 (file)
@@ -1,7 +1,7 @@
 #include "test-tool.h"
 #include "commit-graph.h"
 #include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "bloom.h"
 #include "setup.h"
 
index 211addaa005c9f13d09eac2277984fb9403134c8..e9a444ddba55b49c9c47ceb3b27a31d3e022a8dc 100644 (file)
@@ -2,7 +2,7 @@
 #include "hex.h"
 #include "midx.h"
 #include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "pack-bitmap.h"
 #include "packfile.h"
 #include "setup.h"
index 15fa3f880cbce740288331d692579dd0203058af..fb18831ec2fe9a467f723508830064424ac586be 100644 (file)
@@ -3,9 +3,10 @@
 #include "refs.h"
 #include "setup.h"
 #include "worktree.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "path.h"
 #include "repository.h"
+#include "strbuf.h"
 #include "revision.h"
 
 struct flag_definition {
index bafd2a5bf95b3e31cab6397d623329e835f5e0fc..4cd8a952e5c6f55fbb3cfdbffe8c3be07bf008d7 100644 (file)
@@ -4,7 +4,7 @@
 #include "config.h"
 #include "environment.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "object.h"
 #include "repository.h"
 #include "setup.h"
diff --git a/tag.c b/tag.c
index 96dbd5b2d5501e31b7a7bb75d7630347bfdc24c0..c5426484b22691f2d9c3d9aedf8e6a7d2aaa3acf 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -2,7 +2,7 @@
 #include "environment.h"
 #include "tag.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit.h"
 #include "tree.h"
 #include "blob.h"
index db1f7038dae900a3b49b0658d16c08d3146edd53..5f9074ad1c0b063a0cb906c2dc6182357adcd5ee 100644 (file)
@@ -11,7 +11,7 @@
 #include "strbuf.h"
 #include "strvec.h"
 #include "quote.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 
 struct tmp_objdir {
        struct strbuf path;
index 67afdae57c1c1d0da0d88b1e9823ed6b4fefe4ca..4dc187a3885bcbf5180e85eb37b893d400e600b6 100644 (file)
@@ -27,7 +27,7 @@
 #include "transport-internal.h"
 #include "protocol.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "color.h"
 #include "bundle-uri.h"
 #include "wrapper.h"
index d3c48e06df05b707af9f753fd4a3d4641173c00c..42ed86ef581ad745fabc6c919fce3c174ff45537 100644 (file)
@@ -5,7 +5,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "object-file.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "trace2.h"
 #include "tree.h"
 #include "pathspec.h"
diff --git a/tree.c b/tree.c
index 0dd2029a8a2905338ac7d7cd9062bd9662a2e9f0..e118914a76a3fdf2ce617a8ca50d62294e72c6f9 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -3,7 +3,7 @@
 #include "hex.h"
 #include "tree.h"
 #include "object-name.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "blob.h"
 #include "commit.h"
 #include "tag.h"
index 4b620df30314570ec5cf6f0d7800b197f3238e15..87517364dc0190acb499ca6d2972e69e1a9fe74e 100644 (file)
@@ -23,7 +23,7 @@
 #include "symlinks.h"
 #include "trace2.h"
 #include "fsmonitor.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "promisor-remote.h"
 #include "entry.h"
 #include "parallel-checkout.h"
index d3312006a32bebdc67c4395b6468db328b501c86..318b650b1e818d87754008fdfd6dd13ec52b7c91 100644 (file)
@@ -7,7 +7,7 @@
 #include "pkt-line.h"
 #include "sideband.h"
 #include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "oid-array.h"
 #include "tag.h"
 #include "object.h"
index 24ff7dfdc28a43a0f2b8535fd417b84eb0bede42..65002a7220adc2e60aafe6a29555df1cee167ad0 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -3,8 +3,9 @@
 #include "hex.h"
 #include "walker.h"
 #include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
 #include "commit.h"
+#include "strbuf.h"
 #include "tree.h"
 #include "tree-walk.h"
 #include "tag.h"
index 0460e03f5edd3538ff6ef6ff46d146aec1d06611..abc7275a52814b859b85380556f024fae64b2274 100644 (file)
@@ -1,7 +1,8 @@
 #include "git-compat-util.h"
 #include "config.h"
 #include "hex.h"
-#include "object-store.h"
+#include "object-store-ll.h"
+#include "strbuf.h"
 #include "xdiff-interface.h"
 #include "xdiff/xtypes.h"
 #include "xdiff/xdiffi.h"