]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs: adjust names for `init` and `init_db` callbacks
authorPatrick Steinhardt <ps@pks.im>
Fri, 17 May 2024 08:18:14 +0000 (10:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 17 May 2024 17:33:36 +0000 (10:33 -0700)
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>
refs/files-backend.c
refs/packed-backend.c
refs/packed-backend.h

index a098d14ea00ed6db449e5d3cc8dff28594228977..2c9d5e0747582a92fed034de182d142a68bd0cd2 100644 (file)
@@ -89,9 +89,9 @@ static void clear_loose_ref_cache(struct files_ref_store *refs)
  * Create a new submodule ref cache and add it to the internal
  * set of caches.
  */
-static struct ref_store *files_ref_store_create(struct repository *repo,
-                                               const char *gitdir,
-                                               unsigned int flags)
+static struct ref_store *files_ref_store_init(struct repository *repo,
+                                             const char *gitdir,
+                                             unsigned int flags)
 {
        struct files_ref_store *refs = xcalloc(1, sizeof(*refs));
        struct ref_store *ref_store = (struct ref_store *)refs;
@@ -102,7 +102,7 @@ static struct ref_store *files_ref_store_create(struct repository *repo,
        get_common_dir_noenv(&sb, gitdir);
        refs->gitcommondir = strbuf_detach(&sb, NULL);
        refs->packed_ref_store =
-               packed_ref_store_create(repo, refs->gitcommondir, flags);
+               packed_ref_store_init(repo, refs->gitcommondir, flags);
 
        chdir_notify_reparent("files-backend $GIT_DIR", &refs->base.gitdir);
        chdir_notify_reparent("files-backend $GIT_COMMONDIR",
@@ -3283,7 +3283,7 @@ static int files_init_db(struct ref_store *ref_store,
 
 struct ref_storage_be refs_be_files = {
        .name = "files",
-       .init = files_ref_store_create,
+       .init = files_ref_store_init,
        .init_db = files_init_db,
        .transaction_prepare = files_transaction_prepare,
        .transaction_finish = files_transaction_finish,
index 4e826c05ff2b34986a5844cd40734b10b0298204..a3c5a75073b62692f1bf753973cb4427eec80c14 100644 (file)
@@ -200,9 +200,9 @@ static int release_snapshot(struct snapshot *snapshot)
        }
 }
 
-struct ref_store *packed_ref_store_create(struct repository *repo,
-                                         const char *gitdir,
-                                         unsigned int store_flags)
+struct ref_store *packed_ref_store_init(struct repository *repo,
+                                       const char *gitdir,
+                                       unsigned int store_flags)
 {
        struct packed_ref_store *refs = xcalloc(1, sizeof(*refs));
        struct ref_store *ref_store = (struct ref_store *)refs;
@@ -1244,9 +1244,9 @@ int packed_refs_is_locked(struct ref_store *ref_store)
 static const char PACKED_REFS_HEADER[] =
        "# pack-refs with: peeled fully-peeled sorted \n";
 
-static int packed_init_db(struct ref_store *ref_store UNUSED,
-                         int flags UNUSED,
-                         struct strbuf *err UNUSED)
+static int packed_ref_store_init_db(struct ref_store *ref_store UNUSED,
+                                   int flags UNUSED,
+                                   struct strbuf *err UNUSED)
 {
        /* Nothing to do. */
        return 0;
@@ -1706,8 +1706,8 @@ static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_s
 
 struct ref_storage_be refs_be_packed = {
        .name = "packed",
-       .init = packed_ref_store_create,
-       .init_db = packed_init_db,
+       .init = packed_ref_store_init,
+       .init_db = packed_ref_store_init_db,
        .transaction_prepare = packed_transaction_prepare,
        .transaction_finish = packed_transaction_finish,
        .transaction_abort = packed_transaction_abort,
index 9dd8a344c34dd7ae078f8226abf044219d5f3a3c..09437ad13bdf05cae921008e4f026047cc847cfe 100644 (file)
@@ -13,9 +13,9 @@ struct ref_transaction;
  * even among packed refs.
  */
 
-struct ref_store *packed_ref_store_create(struct repository *repo,
-                                         const char *gitdir,
-                                         unsigned int store_flags);
+struct ref_store *packed_ref_store_init(struct repository *repo,
+                                       const char *gitdir,
+                                       unsigned int store_flags);
 
 /*
  * Lock the packed-refs file for writing. Flags is passed to