]>
Commit | Line | Data |
---|---|---|
d88f9fdf SB |
1 | #ifndef REPLACE_OBJECT_H |
2 | #define REPLACE_OBJECT_H | |
3 | ||
47f351e9 SB |
4 | #include "oidmap.h" |
5 | #include "repository.h" | |
c3c36d7d | 6 | #include "object-store.h" |
47f351e9 | 7 | |
d88f9fdf SB |
8 | struct replace_object { |
9 | struct oidmap_entry original; | |
10 | struct object_id replacement; | |
11 | }; | |
12 | ||
d6538246 DS |
13 | void prepare_replace_object(struct repository *r); |
14 | ||
47f351e9 SB |
15 | /* |
16 | * This internal function is only declared here for the benefit of | |
17 | * lookup_replace_object(). Please do not call it directly. | |
18 | */ | |
55454427 | 19 | const struct object_id *do_lookup_replace_object(struct repository *r, |
ad6dad09 | 20 | const struct object_id *oid); |
47f351e9 SB |
21 | |
22 | /* | |
23 | * If object sha1 should be replaced, return the replacement object's | |
24 | * name (replaced recursively, if necessary). The return value is | |
25 | * either sha1 or a pointer to a permanently-allocated value. When | |
26 | * object replacement is suppressed, always return sha1. | |
27 | */ | |
90e777f1 SB |
28 | static inline const struct object_id *lookup_replace_object(struct repository *r, |
29 | const struct object_id *oid) | |
47f351e9 | 30 | { |
6ebd1caf | 31 | if (!read_replace_refs || |
90e777f1 SB |
32 | (r->objects->replace_map && |
33 | r->objects->replace_map->map.tablesize == 0)) | |
47f351e9 | 34 | return oid; |
90e777f1 | 35 | return do_lookup_replace_object(r, oid); |
47f351e9 SB |
36 | } |
37 | ||
d88f9fdf | 38 | #endif /* REPLACE_OBJECT_H */ |