summaryrefslogtreecommitdiff
path: root/object-store.h
diff options
context:
space:
mode:
Diffstat (limited to 'object-store.h')
-rw-r--r--object-store.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/object-store.h b/object-store.h
index 6f89482..5399601 100644
--- a/object-store.h
+++ b/object-store.h
@@ -245,22 +245,22 @@ static inline void *repo_read_object_file(struct repository *r,
/* 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 *);
-int hash_object_file(const struct git_hash_algo *algo, const void *buf,
- unsigned long len, const char *type,
- struct object_id *oid);
+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,
- const char *type, struct object_id *oid,
+ enum object_type type, struct object_id *oid,
unsigned flags);
static inline int write_object_file(const void *buf, unsigned long len,
- const char *type, struct object_id *oid)
+ enum object_type type, struct object_id *oid)
{
return write_object_file_flags(buf, len, type, oid, 0);
}
-int hash_object_file_literally(const void *buf, unsigned long len,
- const char *type, struct object_id *oid,
- unsigned flags);
+int write_object_file_literally(const void *buf, unsigned long len,
+ const char *type, struct object_id *oid,
+ unsigned flags);
/*
* Add an object file to the in-memory object store, without writing it
@@ -312,10 +312,6 @@ int has_object(struct repository *r, const struct object_id *oid,
* These functions can be removed once all callers have migrated to
* has_object() and/or oid_object_info_extended().
*/
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define has_sha1_file_with_flags(sha1, flags) repo_has_sha1_file_with_flags(the_repository, sha1, flags)
-#define has_sha1_file(sha1) repo_has_sha1_file(the_repository, sha1)
-#endif
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);
@@ -331,6 +327,14 @@ int repo_has_object_file_with_flags(struct repository *r,
*/
int has_loose_object_nonlocal(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);
/*