cocci: introduce rules to transform "refs" to pass ref store
Most of the functions in "refs.h" have two flavors: one that accepts a `struct ref_store`, and one that figures it out via `the_repository`. As part of the libification efforts we want to get rid of the latter variant and stop relying on `the_repository` altogether. Introduce a set of Coccinelle rules that transform callers of the "refs" interfaces to pass a `struct ref_store`. These rules are not yet applied by this patch so that it can be reviewed standalone more easily. This will be done in the next patch. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
May 7, 2024 at 09:11 UTC
b198ee0b3d4f4471241d31863e7902ecf24955f7
1 file changed
+103
contrib/coccinelle/refs.cocci
new
+103
@@ -0,0 +1,103 @@
1
+// Migrate "refs.h" to not rely on `the_repository` implicitly anymore.
2
+@@
3
+@@
4
+(
5
+- resolve_ref_unsafe
6
++ refs_resolve_ref_unsafe
7
+|
8
+- resolve_refdup
9
++ refs_resolve_refdup
10
+|
11
+- read_ref_full
12
++ refs_read_ref_full
13
+|
14
+- read_ref
15
++ refs_read_ref
16
+|
17
+- ref_exists
18
++ refs_ref_exists
19
+|
20
+- head_ref
21
++ refs_head_ref
22
+|
23
+- for_each_ref
24
++ refs_for_each_ref
25
+|
26
+- for_each_ref_in
27
++ refs_for_each_ref_in
28
+|
29
+- for_each_fullref_in
30
++ refs_for_each_fullref_in
31
+|
32
+- for_each_tag_ref
33
++ refs_for_each_tag_ref
34
+|
35
+- for_each_branch_ref
36
++ refs_for_each_branch_ref
37
+|
38
+- for_each_remote_ref
39
++ refs_for_each_remote_ref
40
+|
41
+- for_each_glob_ref
42
++ refs_for_each_glob_ref
43
+|
44
+- for_each_glob_ref_in
45
++ refs_for_each_glob_ref_in
46
+|
47
+- head_ref_namespaced
48
++ refs_head_ref_namespaced
49
+|
50
+- for_each_namespaced_ref
51
++ refs_for_each_namespaced_ref
52
+|
53
+- for_each_rawref
54
++ refs_for_each_rawref
55
+|
56
+- safe_create_reflog
57
++ refs_create_reflog
58
+|
59
+- reflog_exists
60
++ refs_reflog_exists
61
+|
62
+- delete_ref
63
++ refs_delete_ref
64
+|
65
+- delete_refs
66
++ refs_delete_refs
67
+|
68
+- delete_reflog
69
++ refs_delete_reflog
70
+|
71
+- for_each_reflog_ent
72
++ refs_for_each_reflog_ent
73
+|
74
+- for_each_reflog_ent_reverse
75
++ refs_for_each_reflog_ent_reverse
76
+|
77
+- for_each_reflog
78
++ refs_for_each_reflog
79
+|
80
+- shorten_unambiguous_ref
81
++ refs_shorten_unambiguous_ref
82
+|
83
+- rename_ref
84
++ refs_rename_ref
85
+|
86
+- copy_existing_ref
87
++ refs_copy_existing_ref
88
+|
89
+- create_symref
90
++ refs_create_symref
91
+|
92
+- ref_transaction_begin
93
++ ref_store_transaction_begin
94
+|
95
+- update_ref
96
++ refs_update_ref
97
+|
98
+- reflog_expire
99
++ refs_reflog_expire
100
+)
101
+ (
102
++ get_main_ref_store(the_repository),
103
+ ...)