refs: adjust names for `init` and `init_db` callbacks
The names of the functions that implement the `init` and `init_db` callbacks in the "files" and "packed" backends do not match the names of the callbacks, which is inconsistent. Rename them so that they match, which makes it easier to discover their respective implementations. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
May 17, 2024 at 10:18 UTC
1febabff7a3945537b5cd7ec0ad4a4e8b2ba9001
3 files changed
+16
-16
refs/files-backend.c
+5
-5
@@ -89,9 +89,9 @@ static void clear_loose_ref_cache(struct files_ref_store *refs)
89
* Create a new submodule ref cache and add it to the internal
90
* set of caches.
91
*/
92
-static struct ref_store *files_ref_store_create(struct repository *repo,
93
- const char *gitdir,
94
- unsigned int flags)
92
+static struct ref_store *files_ref_store_init(struct repository *repo,
93
+ const char *gitdir,
94
+ unsigned int flags)
95
{
96
struct files_ref_store *refs = xcalloc(1, sizeof(*refs));
97
struct ref_store *ref_store = (struct ref_store *)refs;
@@ -102,7 +102,7 @@ static struct ref_store *files_ref_store_create(struct repository *repo,
102
get_common_dir_noenv(&sb, gitdir);
103
refs->gitcommondir = strbuf_detach(&sb, NULL);
104
refs->packed_ref_store =
105
- packed_ref_store_create(repo, refs->gitcommondir, flags);
105
+ packed_ref_store_init(repo, refs->gitcommondir, flags);
106
107
chdir_notify_reparent("files-backend $GIT_DIR", &refs->base.gitdir);
108
chdir_notify_reparent("files-backend $GIT_COMMONDIR",
@@ -3283,7 +3283,7 @@ static int files_init_db(struct ref_store *ref_store,
3283
3284
struct ref_storage_be refs_be_files = {
3285
.name = "files",
3286
- .init = files_ref_store_create,
3286
+ .init = files_ref_store_init,
3287
.init_db = files_init_db,
3288
.transaction_prepare = files_transaction_prepare,
3289
.transaction_finish = files_transaction_finish,
refs/packed-backend.c
+8
-8
@@ -200,9 +200,9 @@ static int release_snapshot(struct snapshot *snapshot)
200
}
201
}
202
203
-struct ref_store *packed_ref_store_create(struct repository *repo,
204
- const char *gitdir,
205
- unsigned int store_flags)
203
+struct ref_store *packed_ref_store_init(struct repository *repo,
204
+ const char *gitdir,
205
+ unsigned int store_flags)
206
{
207
struct packed_ref_store *refs = xcalloc(1, sizeof(*refs));
208
struct ref_store *ref_store = (struct ref_store *)refs;
@@ -1244,9 +1244,9 @@ int packed_refs_is_locked(struct ref_store *ref_store)
1244
static const char PACKED_REFS_HEADER[] =
1245
"# pack-refs with: peeled fully-peeled sorted \n";
1246
1247
-static int packed_init_db(struct ref_store *ref_store UNUSED,
1248
- int flags UNUSED,
1249
- struct strbuf *err UNUSED)
1247
+static int packed_ref_store_init_db(struct ref_store *ref_store UNUSED,
1248
+ int flags UNUSED,
1249
+ struct strbuf *err UNUSED)
1250
{
1251
/* Nothing to do. */
1252
return 0;
@@ -1706,8 +1706,8 @@ static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_s
1706
1707
struct ref_storage_be refs_be_packed = {
1708
.name = "packed",
1709
- .init = packed_ref_store_create,
1710
- .init_db = packed_init_db,
1709
+ .init = packed_ref_store_init,
1710
+ .init_db = packed_ref_store_init_db,
1711
.transaction_prepare = packed_transaction_prepare,
1712
.transaction_finish = packed_transaction_finish,
1713
.transaction_abort = packed_transaction_abort,
refs/packed-backend.h
+3
-3
@@ -13,9 +13,9 @@ struct ref_transaction;
13
* even among packed refs.
14
*/
15
16
-struct ref_store *packed_ref_store_create(struct repository *repo,
17
- const char *gitdir,
18
- unsigned int store_flags);
16
+struct ref_store *packed_ref_store_init(struct repository *repo,
17
+ const char *gitdir,
18
+ unsigned int store_flags);
19
20
/*
21
* Lock the packed-refs file for writing. Flags is passed to