replace-object: add repository argument to lookup_replace_object
[git.git] / replace-object.h
blobdff57bfa1e20aff152ce4a2acfd2b2c1db144015
1 #ifndef REPLACE_OBJECT_H
2 #define REPLACE_OBJECT_H
4 #include "oidmap.h"
5 #include "repository.h"
6 #include "object-store.h"
8 struct replace_object {
9 struct oidmap_entry original;
10 struct object_id replacement;
14 * This internal function is only declared here for the benefit of
15 * lookup_replace_object(). Please do not call it directly.
17 #define do_lookup_replace_object(r, s) do_lookup_replace_object_##r(s)
18 extern const struct object_id *do_lookup_replace_object_the_repository(const struct object_id *oid);
21 * If object sha1 should be replaced, return the replacement object's
22 * name (replaced recursively, if necessary). The return value is
23 * either sha1 or a pointer to a permanently-allocated value. When
24 * object replacement is suppressed, always return sha1.
26 #define lookup_replace_object(r, s) lookup_replace_object_##r(s)
27 static inline const struct object_id *lookup_replace_object_the_repository(const struct object_id *oid)
29 if (!check_replace_refs ||
30 (the_repository->objects->replace_map &&
31 the_repository->objects->replace_map->map.tablesize == 0))
32 return oid;
33 return do_lookup_replace_object(the_repository, oid);
36 #endif /* REPLACE_OBJECT_H */