object-store: move object access functions to object-store.h
This should make these functions easier to find and cache.h less overwhelming to read. In particular, this moves: - read_object_file - oid_object_info - write_object_file As a result, most of the codebase needs to #include object-store.h. In this patch the #include is only added to files that would fail to compile otherwise. It would be better to #include wherever identifiers from the header are used. That can happen later when we have better tooling for it. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
14ba97f81c
commit
cbd53a2193
1
apply.c
1
apply.c
@ -9,6 +9,7 @@
|
||||
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "delta.h"
|
||||
#include "diff.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "config.h"
|
||||
#include "tar.h"
|
||||
#include "archive.h"
|
||||
#include "object-store.h"
|
||||
#include "streaming.h"
|
||||
#include "run-command.h"
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "archive.h"
|
||||
#include "streaming.h"
|
||||
#include "utf8.h"
|
||||
#include "object-store.h"
|
||||
#include "userdiff.h"
|
||||
#include "xdiff-interface.h"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tree-walk.h"
|
||||
#include "attr.h"
|
||||
|
1
blame.c
1
blame.c
@ -1,5 +1,6 @@
|
||||
#include "cache.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "cache-tree.h"
|
||||
#include "mergesort.h"
|
||||
#include "diff.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "line-log.h"
|
||||
#include "dir.h"
|
||||
#include "progress.h"
|
||||
#include "object-store.h"
|
||||
#include "blame.h"
|
||||
|
||||
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "tree-walk.h"
|
||||
#include "sha1-array.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
|
||||
struct batch_options {
|
||||
int enabled;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "lockfile.h"
|
||||
#include "parse-options.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tree.h"
|
||||
#include "tree-walk.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "parse-options.h"
|
||||
#include "fetch-pack.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "tree.h"
|
||||
#include "tree-walk.h"
|
||||
#include "unpack-trees.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tree.h"
|
||||
#include "builtin.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "hashmap.h"
|
||||
#include "argv-array.h"
|
||||
#include "run-command.h"
|
||||
#include "object-store.h"
|
||||
#include "revision.h"
|
||||
#include "list-objects.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "argv-array.h"
|
||||
#include "strbuf.h"
|
||||
#include "lockfile.h"
|
||||
#include "object-store.h"
|
||||
#include "dir.h"
|
||||
|
||||
static char *diff_gui_tool;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "object.h"
|
||||
#include "tag.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "config.h"
|
||||
#include "repository.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "builtin.h"
|
||||
#include "string-list.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "diff.h"
|
||||
#include "revision.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "quote.h"
|
||||
#include "parse-options.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "color.h"
|
||||
#include "commit.h"
|
||||
#include "diff.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
#include "commit.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "builtin.h"
|
||||
#include "tree-walk.h"
|
||||
#include "xdiff-interface.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "exec_cmd.h"
|
||||
#include "merge-blobs.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "builtin.h"
|
||||
#include "tag.h"
|
||||
#include "replace-object.h"
|
||||
#include "object-store.h"
|
||||
|
||||
/*
|
||||
* A signature file has a very simple fixed format: four lines
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "quote.h"
|
||||
#include "tree.h"
|
||||
#include "parse-options.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static struct treeent {
|
||||
unsigned mode;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "config.h"
|
||||
#include "builtin.h"
|
||||
#include "notes.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "pretty.h"
|
||||
#include "refs.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "reachable.h"
|
||||
#include "parse-options.h"
|
||||
#include "progress.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static const char * const prune_usage[] = {
|
||||
N_("git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"),
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "tmp-objdir.h"
|
||||
#include "oidset.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
#include "protocol.h"
|
||||
|
||||
static const char * const receive_pack_usage[] = {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
#include "lockfile.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "refs.h"
|
||||
#include "dir.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "strbuf.h"
|
||||
#include "run-command.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "argv-array.h"
|
||||
|
||||
static const char * const builtin_remote_usage[] = {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "list-objects.h"
|
||||
#include "list-objects-filter.h"
|
||||
#include "list-objects-filter-options.h"
|
||||
#include "object-store.h"
|
||||
#include "pack.h"
|
||||
#include "pack-bitmap.h"
|
||||
#include "builtin.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "builtin.h"
|
||||
#include "cache.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "object.h"
|
||||
#include "tag.h"
|
||||
#include "string-list.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "config.h"
|
||||
#include "builtin.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "tag.h"
|
||||
#include "run-command.h"
|
||||
#include "parse-options.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "builtin.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static char *create_temp_file(struct object_id *oid)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "builtin.h"
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "object.h"
|
||||
#include "delta.h"
|
||||
#include "pack.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "builtin.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "run-command.h"
|
||||
#include <signal.h>
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "pack.h"
|
||||
#include "strbuf.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static struct bulk_checkin_state {
|
||||
unsigned plugged:1;
|
||||
|
1
bundle.c
1
bundle.c
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "lockfile.h"
|
||||
#include "bundle.h"
|
||||
#include "object-store.h"
|
||||
#include "object.h"
|
||||
#include "commit.h"
|
||||
#include "diff.h"
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "tree.h"
|
||||
#include "tree-walk.h"
|
||||
#include "cache-tree.h"
|
||||
#include "object-store.h"
|
||||
|
||||
#ifndef DEBUG
|
||||
#define DEBUG 0
|
||||
|
117
cache.h
117
cache.h
@ -1183,32 +1183,6 @@ extern char *xdg_config_home(const char *filename);
|
||||
*/
|
||||
extern char *xdg_cache_home(const char *filename);
|
||||
|
||||
extern void *read_object_file_extended(const struct object_id *oid,
|
||||
enum object_type *type,
|
||||
unsigned long *size, int lookup_replace);
|
||||
static inline void *read_object_file(const struct object_id *oid, enum object_type *type, unsigned long *size)
|
||||
{
|
||||
return read_object_file_extended(oid, type, size, 1);
|
||||
}
|
||||
|
||||
/* 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 *);
|
||||
|
||||
extern int hash_object_file(const void *buf, unsigned long len,
|
||||
const char *type, struct object_id *oid);
|
||||
|
||||
extern int write_object_file(const void *buf, unsigned long len,
|
||||
const char *type, struct object_id *oid);
|
||||
|
||||
extern int hash_object_file_literally(const void *buf, unsigned long len,
|
||||
const char *type, struct object_id *oid,
|
||||
unsigned flags);
|
||||
|
||||
extern int pretend_object_file(void *, unsigned long, enum object_type,
|
||||
struct object_id *oid);
|
||||
|
||||
extern int force_object_loose(const struct object_id *oid, time_t mtime);
|
||||
|
||||
extern int git_open_cloexec(const char *name, int flags);
|
||||
#define git_open(name) git_open_cloexec(name, O_RDONLY)
|
||||
extern int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz);
|
||||
@ -1218,43 +1192,6 @@ extern int check_object_signature(const struct object_id *oid, void *buf, unsign
|
||||
|
||||
extern int finalize_object_file(const char *tmpfile, const char *filename);
|
||||
|
||||
/*
|
||||
* Open the loose object at path, check its hash, and return the contents,
|
||||
* 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,
|
||||
enum object_type *type,
|
||||
unsigned long *size,
|
||||
void **contents);
|
||||
|
||||
/*
|
||||
* Convenience for sha1_object_info_extended() with a NULL struct
|
||||
* object_info. OBJECT_INFO_SKIP_CACHED is automatically set; pass
|
||||
* nonzero flags to also set other flags.
|
||||
*/
|
||||
extern int has_sha1_file_with_flags(const unsigned char *sha1, int flags);
|
||||
static inline int has_sha1_file(const unsigned char *sha1)
|
||||
{
|
||||
return has_sha1_file_with_flags(sha1, 0);
|
||||
}
|
||||
|
||||
/* Same as the above, except for struct object_id. */
|
||||
extern int has_object_file(const struct object_id *oid);
|
||||
extern int has_object_file_with_flags(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.
|
||||
*/
|
||||
extern int has_loose_object_nonlocal(const unsigned char *sha1);
|
||||
|
||||
extern void assert_oid_type(const struct object_id *oid, enum object_type expect);
|
||||
|
||||
/* Helper to check and "touch" a file */
|
||||
extern int check_and_freshen_file(const char *fn, int freshen);
|
||||
|
||||
@ -1624,60 +1561,6 @@ int for_each_loose_file_in_objdir_buf(struct strbuf *path,
|
||||
#define FOR_EACH_OBJECT_LOCAL_ONLY 0x1
|
||||
extern int for_each_loose_object(each_loose_object_fn, void *, unsigned flags);
|
||||
|
||||
struct object_info {
|
||||
/* Request */
|
||||
enum object_type *typep;
|
||||
unsigned long *sizep;
|
||||
off_t *disk_sizep;
|
||||
unsigned char *delta_base_sha1;
|
||||
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 {NULL}
|
||||
|
||||
/* 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 check cached storage */
|
||||
#define OBJECT_INFO_SKIP_CACHED 4
|
||||
/* Do not retry packed storage after checking packed and loose storage */
|
||||
#define OBJECT_INFO_QUICK 8
|
||||
/* Do not check loose object */
|
||||
#define OBJECT_INFO_IGNORE_LOOSE 16
|
||||
|
||||
int oid_object_info_extended(struct repository *r,
|
||||
const struct object_id *,
|
||||
struct object_info *, unsigned flags);
|
||||
|
||||
/*
|
||||
* Set this to 0 to prevent sha1_object_info_extended() from fetching missing
|
||||
* blobs. This has a difference only if extensions.partialClone is set.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "cache.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "blob.h"
|
||||
#include "diff.h"
|
||||
|
1
commit.c
1
commit.c
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "tag.h"
|
||||
#include "commit.h"
|
||||
#include "object-store.h"
|
||||
#include "pkt-line.h"
|
||||
#include "utf8.h"
|
||||
#include "diff.h"
|
||||
|
1
config.c
1
config.c
@ -14,6 +14,7 @@
|
||||
#include "quote.h"
|
||||
#include "hashmap.h"
|
||||
#include "string-list.h"
|
||||
#include "object-store.h"
|
||||
#include "utf8.h"
|
||||
#include "dir.h"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#define NO_THE_INDEX_COMPATIBILITY_MACROS
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "attr.h"
|
||||
#include "run-command.h"
|
||||
#include "quote.h"
|
||||
|
1
diff.c
1
diff.c
@ -13,6 +13,7 @@
|
||||
#include "attr.h"
|
||||
#include "run-command.h"
|
||||
#include "utf8.h"
|
||||
#include "object-store.h"
|
||||
#include "userdiff.h"
|
||||
#include "submodule-config.h"
|
||||
#include "submodule.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "cache.h"
|
||||
#include "diff.h"
|
||||
#include "diffcore.h"
|
||||
#include "object-store.h"
|
||||
#include "hashmap.h"
|
||||
#include "progress.h"
|
||||
|
||||
|
1
dir.c
1
dir.c
@ -11,6 +11,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "dir.h"
|
||||
#include "object-store.h"
|
||||
#include "attr.h"
|
||||
#include "refs.h"
|
||||
#include "wildmatch.h"
|
||||
|
1
entry.c
1
entry.c
@ -1,5 +1,6 @@
|
||||
#include "cache.h"
|
||||
#include "blob.h"
|
||||
#include "object-store.h"
|
||||
#include "dir.h"
|
||||
#include "streaming.h"
|
||||
#include "submodule.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "sha1-array.h"
|
||||
#include "oidset.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static int transfer_unpack_limit = -1;
|
||||
static int fetch_unpack_limit = -1;
|
||||
|
1
fsck.c
1
fsck.c
@ -1,4 +1,5 @@
|
||||
#include "cache.h"
|
||||
#include "object-store.h"
|
||||
#include "object.h"
|
||||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
|
1
grep.c
1
grep.c
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "grep.h"
|
||||
#include "object-store.h"
|
||||
#include "userdiff.h"
|
||||
#include "xdiff-interface.h"
|
||||
#include "diff.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "list-objects-filter.h"
|
||||
#include "list-objects-filter-options.h"
|
||||
#include "oidset.h"
|
||||
#include "object-store.h"
|
||||
|
||||
/* Remember to update object flag allocation in object.h */
|
||||
/*
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "list-objects-filter.h"
|
||||
#include "list-objects-filter-options.h"
|
||||
#include "packfile.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static void process_blob(struct rev_info *revs,
|
||||
struct blob *blob,
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "diff.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tag.h"
|
||||
#include "graph.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "string-list.h"
|
||||
#include "mailmap.h"
|
||||
#include "object-store.h"
|
||||
|
||||
#define DEBUG_MAILMAP 0
|
||||
#if DEBUG_MAILMAP
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "tree.h"
|
||||
#include "tree-walk.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static int score_missing(unsigned mode, const char *path)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "ll-merge.h"
|
||||
#include "blob.h"
|
||||
#include "merge-blobs.h"
|
||||
#include "object-store.h"
|
||||
|
||||
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "advice.h"
|
||||
#include "lockfile.h"
|
||||
#include "cache-tree.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "blob.h"
|
||||
#include "builtin.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "cache.h"
|
||||
#include "notes-cache.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "refs.h"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "commit.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "diff.h"
|
||||
#include "diffcore.h"
|
||||
#include "xdiff-interface.h"
|
||||
|
1
notes.c
1
notes.c
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "notes.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
#include "utf8.h"
|
||||
|
117
object-store.h
117
object-store.h
@ -137,4 +137,121 @@ void sha1_file_name(struct repository *r, struct strbuf *buf, const unsigned cha
|
||||
|
||||
void *map_sha1_file(struct repository *r, const unsigned char *sha1, unsigned long *size);
|
||||
|
||||
extern void *read_object_file_extended(const struct object_id *oid,
|
||||
enum object_type *type,
|
||||
unsigned long *size, int lookup_replace);
|
||||
static inline void *read_object_file(const struct object_id *oid, enum object_type *type, unsigned long *size)
|
||||
{
|
||||
return read_object_file_extended(oid, type, size, 1);
|
||||
}
|
||||
|
||||
/* 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 *);
|
||||
|
||||
extern int hash_object_file(const void *buf, unsigned long len,
|
||||
const char *type, struct object_id *oid);
|
||||
|
||||
extern int write_object_file(const void *buf, unsigned long len,
|
||||
const char *type, struct object_id *oid);
|
||||
|
||||
extern int hash_object_file_literally(const void *buf, unsigned long len,
|
||||
const char *type, struct object_id *oid,
|
||||
unsigned flags);
|
||||
|
||||
extern int pretend_object_file(void *, unsigned long, enum object_type,
|
||||
struct object_id *oid);
|
||||
|
||||
extern int force_object_loose(const struct object_id *oid, time_t mtime);
|
||||
|
||||
/*
|
||||
* Open the loose object at path, check its hash, and return the contents,
|
||||
* 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,
|
||||
enum object_type *type,
|
||||
unsigned long *size,
|
||||
void **contents);
|
||||
|
||||
/*
|
||||
* Convenience for sha1_object_info_extended() with a NULL struct
|
||||
* object_info. OBJECT_INFO_SKIP_CACHED is automatically set; pass
|
||||
* nonzero flags to also set other flags.
|
||||
*/
|
||||
extern int has_sha1_file_with_flags(const unsigned char *sha1, int flags);
|
||||
static inline int has_sha1_file(const unsigned char *sha1)
|
||||
{
|
||||
return has_sha1_file_with_flags(sha1, 0);
|
||||
}
|
||||
|
||||
/* Same as the above, except for struct object_id. */
|
||||
extern int has_object_file(const struct object_id *oid);
|
||||
extern int has_object_file_with_flags(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.
|
||||
*/
|
||||
extern int has_loose_object_nonlocal(const unsigned char *sha1);
|
||||
|
||||
extern void assert_oid_type(const struct object_id *oid, enum object_type expect);
|
||||
|
||||
struct object_info {
|
||||
/* Request */
|
||||
enum object_type *typep;
|
||||
unsigned long *sizep;
|
||||
off_t *disk_sizep;
|
||||
unsigned char *delta_base_sha1;
|
||||
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 {NULL}
|
||||
|
||||
/* 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 check cached storage */
|
||||
#define OBJECT_INFO_SKIP_CACHED 4
|
||||
/* Do not retry packed storage after checking packed and loose storage */
|
||||
#define OBJECT_INFO_QUICK 8
|
||||
/* Do not check loose object */
|
||||
#define OBJECT_INFO_IGNORE_LOOSE 16
|
||||
|
||||
int oid_object_info_extended(struct repository *r,
|
||||
const struct object_id *,
|
||||
struct object_info *, unsigned flags);
|
||||
|
||||
#endif /* OBJECT_STORE_H */
|
||||
|
1
object.c
1
object.c
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "object.h"
|
||||
#include "replace-object.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
#include "commit.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "cache.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tag.h"
|
||||
#include "diff.h"
|
||||
|
@ -3,6 +3,11 @@
|
||||
|
||||
#include "oidset.h"
|
||||
|
||||
/* in object-store.h */
|
||||
struct packed_git;
|
||||
struct object_info;
|
||||
enum object_type;
|
||||
|
||||
/*
|
||||
* Generate the filename to be used for a pack file with checksum "sha1" and
|
||||
* extension "ext". The result is written into the strbuf "buf", overwriting
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "cache-tree.h"
|
||||
#include "refs.h"
|
||||
#include "dir.h"
|
||||
#include "object-store.h"
|
||||
#include "tree.h"
|
||||
#include "commit.h"
|
||||
#include "blob.h"
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "parse-options.h"
|
||||
#include "refs.h"
|
||||
#include "wildmatch.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "remote.h"
|
||||
#include "color.h"
|
||||
|
1
refs.c
1
refs.c
@ -9,6 +9,7 @@
|
||||
#include "iterator.h"
|
||||
#include "refs.h"
|
||||
#include "refs/refs-internal.h"
|
||||
#include "object-store.h"
|
||||
#include "object.h"
|
||||
#include "tag.h"
|
||||
#include "submodule.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "refs.h"
|
||||
#include "remote.h"
|
||||
#include "object-store.h"
|
||||
#include "strbuf.h"
|
||||
#include "url.h"
|
||||
#include "exec_cmd.h"
|
||||
|
1
remote.c
1
remote.c
@ -2,6 +2,7 @@
|
||||
#include "config.h"
|
||||
#include "remote.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "diff.h"
|
||||
#include "revision.h"
|
||||
|
1
rerere.c
1
rerere.c
@ -9,6 +9,7 @@
|
||||
#include "ll-merge.h"
|
||||
#include "attr.h"
|
||||
#include "pathspec.h"
|
||||
#include "object-store.h"
|
||||
#include "sha1-lookup.h"
|
||||
|
||||
#define RESOLVED 0
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "cache.h"
|
||||
#include "object-store.h"
|
||||
#include "tag.h"
|
||||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "config.h"
|
||||
#include "commit.h"
|
||||
#include "refs.h"
|
||||
#include "object-store.h"
|
||||
#include "pkt-line.h"
|
||||
#include "sideband.h"
|
||||
#include "run-command.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "config.h"
|
||||
#include "lockfile.h"
|
||||
#include "dir.h"
|
||||
#include "object-store.h"
|
||||
#include "object.h"
|
||||
#include "commit.h"
|
||||
#include "sequencer.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "tempfile.h"
|
||||
#include "lockfile.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tag.h"
|
||||
#include "pkt-line.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "submodule-config.h"
|
||||
#include "submodule.h"
|
||||
#include "strbuf.h"
|
||||
#include "object-store.h"
|
||||
#include "parse-options.h"
|
||||
|
||||
/*
|
||||
|
1
tag.c
1
tag.c
@ -1,5 +1,6 @@
|
||||
#include "cache.h"
|
||||
#include "tag.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tree.h"
|
||||
#include "blob.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "tree-walk.h"
|
||||
#include "unpack-trees.h"
|
||||
#include "dir.h"
|
||||
#include "object-store.h"
|
||||
#include "tree.h"
|
||||
#include "pathspec.h"
|
||||
|
||||
|
1
tree.c
1
tree.c
@ -2,6 +2,7 @@
|
||||
#include "cache.h"
|
||||
#include "cache-tree.h"
|
||||
#include "tree.h"
|
||||
#include "object-store.h"
|
||||
#include "blob.h"
|
||||
#include "commit.h"
|
||||
#include "tag.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "submodule.h"
|
||||
#include "submodule-config.h"
|
||||
#include "fsmonitor.h"
|
||||
#include "object-store.h"
|
||||
#include "fetch-object.h"
|
||||
|
||||
/*
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "refs.h"
|
||||
#include "pkt-line.h"
|
||||
#include "sideband.h"
|
||||
#include "object-store.h"
|
||||
#include "tag.h"
|
||||
#include "object.h"
|
||||
#include "commit.h"
|
||||
|
1
walker.c
1
walker.c
@ -1,5 +1,6 @@
|
||||
#include "cache.h"
|
||||
#include "walker.h"
|
||||
#include "object-store.h"
|
||||
#include "commit.h"
|
||||
#include "tree.h"
|
||||
#include "tree-walk.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "object-store.h"
|
||||
#include "xdiff-interface.h"
|
||||
#include "xdiff/xtypes.h"
|
||||
#include "xdiff/xdiffi.h"
|
||||
|
Loading…
Reference in New Issue
Block a user