/src/git/replace-object.h
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | #ifndef REPLACE_OBJECT_H  | 
2  |  | #define REPLACE_OBJECT_H  | 
3  |  |  | 
4  |  | #include "oidmap.h"  | 
5  |  | #include "repository.h"  | 
6  |  | #include "object-store-ll.h"  | 
7  |  |  | 
8  |  | struct replace_object { | 
9  |  |   struct oidmap_entry original;  | 
10  |  |   struct object_id replacement;  | 
11  |  | };  | 
12  |  |  | 
13  |  | void prepare_replace_object(struct repository *r);  | 
14  |  |  | 
15  |  | /*  | 
16  |  |  * This internal function is only declared here for the benefit of  | 
17  |  |  * lookup_replace_object().  Please do not call it directly.  | 
18  |  |  */  | 
19  |  | const struct object_id *do_lookup_replace_object(struct repository *r,  | 
20  |  |              const struct object_id *oid);  | 
21  |  |  | 
22  |  | /*  | 
23  |  |  * Some commands disable replace-refs unconditionally, and otherwise each  | 
24  |  |  * repository could alter the core.useReplaceRefs config value.  | 
25  |  |  *  | 
26  |  |  * Return 1 if and only if all of the following are true:  | 
27  |  |  *  | 
28  |  |  *  a. disable_replace_refs() has not been called.  | 
29  |  |  *  b. GIT_NO_REPLACE_OBJECTS is unset or zero.  | 
30  |  |  *  c. the given repository does not have core.useReplaceRefs=false.  | 
31  |  |  */  | 
32  |  | int replace_refs_enabled(struct repository *r);  | 
33  |  |  | 
34  |  | /*  | 
35  |  |  * If object sha1 should be replaced, return the replacement object's  | 
36  |  |  * name (replaced recursively, if necessary).  The return value is  | 
37  |  |  * either sha1 or a pointer to a permanently-allocated value.  When  | 
38  |  |  * object replacement is suppressed, always return sha1.  | 
39  |  |  *  | 
40  |  |  * Note: some thread debuggers might point a data race on the  | 
41  |  |  * replace_map_initialized reading in this function. However, we know there's no  | 
42  |  |  * problem in the value being updated by one thread right after another one read  | 
43  |  |  * it here (and it should be written to only once, anyway).  | 
44  |  |  */  | 
45  |  | static inline const struct object_id *lookup_replace_object(struct repository *r,  | 
46  |  |                   const struct object_id *oid)  | 
47  | 84.2k  | { | 
48  | 84.2k  |   if (!replace_refs_enabled(r) ||  | 
49  | 84.2k  |       (r->objects->replace_map_initialized &&  | 
50  | 84.2k  |        r->objects->replace_map->map.tablesize == 0))  | 
51  | 0  |     return oid;  | 
52  | 84.2k  |   return do_lookup_replace_object(r, oid);  | 
53  | 84.2k  | } Unexecuted instantiation: cat-file.c:lookup_replace_object Unexecuted instantiation: commit-graph.c:lookup_replace_object Unexecuted instantiation: fsck.c:lookup_replace_object Unexecuted instantiation: index-pack.c:lookup_replace_object Unexecuted instantiation: mktag.c:lookup_replace_object Unexecuted instantiation: multi-pack-index.c:lookup_replace_object Unexecuted instantiation: pack-objects.c:lookup_replace_object Unexecuted instantiation: prune.c:lookup_replace_object Unexecuted instantiation: replace.c:lookup_replace_object Unexecuted instantiation: unpack-objects.c:lookup_replace_object Unexecuted instantiation: upload-pack.c:lookup_replace_object Unexecuted instantiation: git.c:lookup_replace_object Unexecuted instantiation: cache-tree.c:lookup_replace_object Unexecuted instantiation: environment.c:lookup_replace_object Unexecuted instantiation: log-tree.c:lookup_replace_object object-file.c:lookup_replace_object Line  | Count  | Source  |  47  | 56.1k  | { |  48  | 56.1k  |   if (!replace_refs_enabled(r) ||  |  49  | 56.1k  |       (r->objects->replace_map_initialized &&  |  50  | 56.1k  |        r->objects->replace_map->map.tablesize == 0))  |  51  | 0  |     return oid;  |  52  | 56.1k  |   return do_lookup_replace_object(r, oid);  |  53  | 56.1k  | }  |  
 object.c:lookup_replace_object Line  | Count  | Source  |  47  | 28.0k  | { |  48  | 28.0k  |   if (!replace_refs_enabled(r) ||  |  49  | 28.0k  |       (r->objects->replace_map_initialized &&  |  50  | 28.0k  |        r->objects->replace_map->map.tablesize == 0))  |  51  | 0  |     return oid;  |  52  | 28.0k  |   return do_lookup_replace_object(r, oid);  |  53  | 28.0k  | }  |  
 Unexecuted instantiation: replace-object.c:lookup_replace_object Unexecuted instantiation: streaming.c:lookup_replace_object  | 
54  |  |  | 
55  |  | /*  | 
56  |  |  * Some commands override config and environment settings for using  | 
57  |  |  * replace references. Use this method to disable the setting and ensure  | 
58  |  |  * those other settings will not override this choice. This applies  | 
59  |  |  * globally to all in-process repositories.  | 
60  |  |  */  | 
61  |  | void disable_replace_refs(void);  | 
62  |  |  | 
63  |  | #endif /* REPLACE_OBJECT_H */  |