object-store: move lookup_replace_object to replace-object.h
[git/git.git] / replace-object.h
CommitLineData
d88f9fdf
SB
1#ifndef REPLACE_OBJECT_H
2#define REPLACE_OBJECT_H
3
47f351e9
SB
4#include "oidmap.h"
5#include "repository.h"
6
d88f9fdf
SB
7struct replace_object {
8 struct oidmap_entry original;
9 struct object_id replacement;
10};
11
47f351e9
SB
12/*
13 * This internal function is only declared here for the benefit of
14 * lookup_replace_object(). Please do not call it directly.
15 */
16extern const struct object_id *do_lookup_replace_object(const struct object_id *oid);
17
18/*
19 * If object sha1 should be replaced, return the replacement object's
20 * name (replaced recursively, if necessary). The return value is
21 * either sha1 or a pointer to a permanently-allocated value. When
22 * object replacement is suppressed, always return sha1.
23 */
24static inline const struct object_id *lookup_replace_object(const struct object_id *oid)
25{
26 if (!check_replace_refs)
27 return oid;
28 return do_lookup_replace_object(oid);
29}
30
d88f9fdf 31#endif /* REPLACE_OBJECT_H */