object: add repository argument to object_as_type
[gitweb.git] / object.h
index 47d1b4902263c4059d8b27e17c7d7fc042dc6771..3faa89578fcf164679df8cae99a4b3be0469218a 100644 (file)
--- a/object.h
+++ b/object.h
@@ -12,6 +12,16 @@ struct parsed_object_pool {
        struct alloc_state *tag_state;
        struct alloc_state *object_state;
        unsigned commit_count;
+
+       /* parent substitutions from .git/info/grafts and .git/shallow */
+       struct commit_graft **grafts;
+       int grafts_alloc, grafts_nr;
+
+       int is_shallow;
+       struct stat_validity *shallow_stat;
+       char *alternate_shallow_file;
+
+       int commit_graft_prepared;
 };
 
 struct parsed_object_pool *parsed_object_pool_new(void);
@@ -99,18 +109,21 @@ extern struct object *get_indexed_object(unsigned int);
  * half-initialised objects, the caller is expected to initialize them
  * by calling parse_object() on them.
  */
-struct object *lookup_object(const unsigned char *sha1);
+#define lookup_object(r, s) lookup_object_##r(s)
+struct object *lookup_object_the_repository(const unsigned char *sha1);
 
 extern void *create_object(struct repository *r, const unsigned char *sha1, void *obj);
 
-void *object_as_type(struct object *obj, enum object_type type, int quiet);
+#define object_as_type(r, o, t, q) object_as_type_##r(o, t, q)
+void *object_as_type_the_repository(struct object *obj, enum object_type type, int quiet);
 
 /*
  * Returns the object, having parsed it to find out what it is.
  *
  * Returns NULL if the object is missing or corrupt.
  */
-struct object *parse_object(const struct object_id *oid);
+#define parse_object(r, oid) parse_object_##r(oid)
+struct object *parse_object_the_repository(const struct object_id *oid);
 
 /*
  * Like parse_object, but will die() instead of returning NULL. If the
@@ -123,7 +136,8 @@ struct object *parse_object_or_die(const struct object_id *oid, const char *name
  * parsing it.  eaten_p indicates if the object has a borrowed copy
  * of buffer and the caller should not free() it.
  */
-struct object *parse_object_buffer(const struct object_id *oid, enum object_type type, unsigned long size, void *buffer, int *eaten_p);
+#define parse_object_buffer(r, o, t, s, b, e) parse_object_buffer_##r(o, t, s, b, e)
+struct object *parse_object_buffer_the_repository(const struct object_id *oid, enum object_type type, unsigned long size, void *buffer, int *eaten_p);
 
 /** Returns the object, with potentially excess memory allocated. **/
 struct object *lookup_unknown_object(const unsigned  char *sha1);