]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cocci: apply the "promisor-remote.h" part of "the_repository.pending"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 28 Mar 2023 13:58:53 +0000 (15:58 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Mar 2023 14:36:46 +0000 (07:36 -0700)
Apply the part of "the_repository.pending.cocci" pertaining to
"promisor-remote.h".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 files changed:
builtin/cat-file.c
builtin/fetch.c
builtin/gc.c
builtin/index-pack.c
builtin/pack-objects.c
builtin/repack.c
cache-tree.c
connected.c
contrib/coccinelle/the_repository.cocci
contrib/coccinelle/the_repository.pending.cocci
diff.c
diffcore-break.c
diffcore-rename.c
list-objects-filter-options.c
merge-ort.c
packfile.c
promisor-remote.h
unpack-trees.c

index caf2d2586198adfabf37864acdb035fb40c09ff4..b72dd91bd1fdf651d7838e590705194b94ff7d76 100644 (file)
@@ -792,7 +792,7 @@ static int batch_objects(struct batch_options *opt)
                if (!memcmp(&data.info, &empty, sizeof(empty)))
                        data.skip_object_info = 1;
 
-               if (has_promisor_remote())
+               if (repo_has_promisor_remote(the_repository))
                        warning("This repository uses promisor remotes. Some objects may not be loaded.");
 
                read_replace_refs = 0;
index 784e344d2bb89ef2ff285841c142b585aaec7738..0020015ca42e2ea14a1819cb130628ab80318e89 100644 (file)
@@ -2008,7 +2008,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)
         * If no prior partial clone/fetch and the current fetch DID NOT
         * request a partial-fetch, do a normal fetch.
         */
-       if (!has_promisor_remote() && !filter_options.choice)
+       if (!repo_has_promisor_remote(the_repository) && !filter_options.choice)
                return;
 
        /*
@@ -2264,7 +2264,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
                        printf("%s\n", oid_to_hex(oid));
                oidset_clear(&acked_commits);
        } else if (remote) {
-               if (filter_options.choice || has_promisor_remote())
+               if (filter_options.choice || repo_has_promisor_remote(the_repository))
                        fetch_one_setup_partial(remote);
                result = fetch_one(remote, argc, argv, prune_tags_ok, stdin_refspecs);
        } else {
index bef26020f996ed82a2a6e186cc5c1ef9ccd27975..a1a2ae4da29af2129b9e7853ff78a122f1f33658 100644 (file)
@@ -699,7 +699,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                        strvec_push(&prune, prune_expire);
                        if (quiet)
                                strvec_push(&prune, "--no-progress");
-                       if (has_promisor_remote())
+                       if (repo_has_promisor_remote(the_repository))
                                strvec_push(&prune,
                                            "--exclude-promisor-objects");
                        prune_cmd.git_cmd = 1;
index 4cf69ee1d97b18c364401c95f2fd28766268e751..de47f3f64418ff295f5cb62cb3437d62ce040681 100644 (file)
@@ -1390,7 +1390,7 @@ static void fix_unresolved_deltas(struct hashfile *f)
                sorted_by_pos[i] = &ref_deltas[i];
        QSORT(sorted_by_pos, nr_ref_deltas, delta_pos_compare);
 
-       if (has_promisor_remote()) {
+       if (repo_has_promisor_remote(the_repository)) {
                /*
                 * Prefetch the delta bases.
                 */
index 3c9b35642cbf7872630b72ec897f8982644fb035..2f2c02589b3b48beb792c0b009dfc3540fa47fc0 100644 (file)
@@ -2078,7 +2078,7 @@ static void check_object(struct object_entry *entry, uint32_t object_index)
 
        if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
                                     OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0) {
-               if (has_promisor_remote()) {
+               if (repo_has_promisor_remote(the_repository)) {
                        prefetch_to_pack(object_index);
                        if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
                                                     OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0)
index f64937953184fd346923bafed6f7868bd99cded5..25658fe732bbaefe30b312a5d78f716d991b2fd8 100644 (file)
@@ -901,7 +901,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                strvec_push(&cmd.args, "--reflog");
                strvec_push(&cmd.args, "--indexed-objects");
        }
-       if (has_promisor_remote())
+       if (repo_has_promisor_remote(the_repository))
                strvec_push(&cmd.args, "--exclude-promisor-objects");
        if (!write_midx) {
                if (write_bitmaps > 0)
index 59610117d0b00a4b50a8ab311b01cb04978ea79f..ab2cc1edf29664603992b581085e8ba8829ccfcf 100644 (file)
@@ -240,7 +240,7 @@ int cache_tree_fully_valid(struct cache_tree *it)
 
 static int must_check_existence(const struct cache_entry *ce)
 {
-       return !(has_promisor_remote() && ce_skip_worktree(ce));
+       return !(repo_has_promisor_remote(the_repository) && ce_skip_worktree(ce));
 }
 
 static int update_one(struct cache_tree *it,
@@ -470,7 +470,7 @@ int cache_tree_update(struct index_state *istate, int flags)
        if (!istate->cache_tree)
                istate->cache_tree = cache_tree();
 
-       if (!(flags & WRITE_TREE_MISSING_OK) && has_promisor_remote())
+       if (!(flags & WRITE_TREE_MISSING_OK) && repo_has_promisor_remote(the_repository))
                prefetch_cache_entries(istate, must_check_existence);
 
        trace_performance_enter();
index b90fd61790cef00d4141bb2eb30f33522e6e8c47..5853fd7cbfd84bf1a2e948708802e5224c1ec675 100644 (file)
@@ -54,7 +54,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
                strbuf_release(&idx_file);
        }
 
-       if (has_promisor_remote()) {
+       if (repo_has_promisor_remote(the_repository)) {
                /*
                 * For partial clones, we don't want to have to do a regular
                 * connectivity check because we have to enumerate and exclude
@@ -97,7 +97,7 @@ no_promisor_pack_found:
        strvec_push(&rev_list.args,"rev-list");
        strvec_push(&rev_list.args, "--objects");
        strvec_push(&rev_list.args, "--stdin");
-       if (has_promisor_remote())
+       if (repo_has_promisor_remote(the_repository))
                strvec_push(&rev_list.args, "--exclude-promisor-objects");
        if (!opt->is_deepening_fetch) {
                strvec_push(&rev_list.args, "--not");
index a325361f961aafff39426fce4c1cc2eb45911db3..d5b644a868752d2362c2348dc2c2c0a3065f6dd1 100644 (file)
 |
 - approximate_object_count
 + repo_approximate_object_count
+// promisor-remote.h
+|
+- promisor_remote_reinit
++ repo_promisor_remote_reinit
+|
+- promisor_remote_find
++ repo_promisor_remote_find
+|
+- has_promisor_remote
++ repo_has_promisor_remote
 )
   (
 + the_repository,
index 9b426e49e665069f631fb4f38fcf548f53722eda..e17a60198c5a0d00a58a5df3b2a28d464f6aaa0c 100644 (file)
@@ -5,17 +5,7 @@
 @@
 @@
 (
-// promisor-remote.h
-- promisor_remote_reinit
-+ repo_promisor_remote_reinit
-|
-- promisor_remote_find
-+ repo_promisor_remote_find
-|
-- has_promisor_remote
-+ repo_has_promisor_remote
 // refs.h
-|
 - dwim_ref
 + repo_dwim_ref
 // rerere.h
diff --git a/diff.c b/diff.c
index 3abeca9d46c1dadd53f154110a3dffb69e3eb952..5278343f95a99860bce35fb96126b3c9921b76c5 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -6860,7 +6860,7 @@ void diffcore_std(struct diff_options *options)
         * If no prefetching occurs, diffcore_rename() will prefetch if it
         * decides that it needs inexact rename detection.
         */
-       if (options->repo == the_repository && has_promisor_remote() &&
+       if (options->repo == the_repository && repo_has_promisor_remote(the_repository) &&
            (options->output_format & output_formats_to_prefetch ||
             options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
                diff_queued_diff_prefetch(options->repo);
index 0d4a14964d00b3a77016fb0ed677b1847d1ab72c..5462420bbbecceedd2366fc5506d4218230181c4 100644 (file)
@@ -65,7 +65,7 @@ static int should_break(struct repository *r,
            oideq(&src->oid, &dst->oid))
                return 0; /* they are the same */
 
-       if (r == the_repository && has_promisor_remote()) {
+       if (r == the_repository && repo_has_promisor_remote(the_repository)) {
                options.missing_object_cb = diff_queued_diff_prefetch;
                options.missing_object_data = r;
        }
index c0422d9e709a65d5a77d1444fcff0a4d313299bd..a97b1322b5171cd33de51c62f6529de6f0d01a80 100644 (file)
@@ -981,7 +981,7 @@ static int find_basename_matches(struct diff_options *options,
                        strintmap_set(&dests, base, i);
        }
 
-       if (options->repo == the_repository && has_promisor_remote()) {
+       if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
                dpf_options.missing_object_cb = basename_prefetch;
                dpf_options.missing_object_data = &prefetch_options;
        }
@@ -1567,7 +1567,7 @@ void diffcore_rename_extended(struct diff_options *options,
 
        /* Finish setting up dpf_options */
        prefetch_options.skip_unmodified = skip_unmodified;
-       if (options->repo == the_repository && has_promisor_remote()) {
+       if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
                dpf_options.missing_object_cb = inexact_prefetch;
                dpf_options.missing_object_data = &prefetch_options;
        }
index ee01bcd2cc365c12c72bcd3f5597ecceecb2a7d9..ccfeabc4778f0605e755412ab2b4d208d18173f9 100644 (file)
@@ -341,7 +341,7 @@ void partial_clone_register(
        char *filter_name;
 
        /* Check if it is already registered */
-       if ((promisor_remote = promisor_remote_find(remote))) {
+       if ((promisor_remote = repo_promisor_remote_find(the_repository, remote))) {
                if (promisor_remote->partial_clone_filter)
                        /*
                         * Remote is already registered and a filter is already
@@ -369,14 +369,15 @@ void partial_clone_register(
        free(filter_name);
 
        /* Make sure the config info are reset */
-       promisor_remote_reinit();
+       repo_promisor_remote_reinit(the_repository);
 }
 
 void partial_clone_get_default_filter_spec(
        struct list_objects_filter_options *filter_options,
        const char *remote)
 {
-       struct promisor_remote *promisor = promisor_remote_find(remote);
+       struct promisor_remote *promisor = repo_promisor_remote_find(the_repository,
+                                                                    remote);
        struct strbuf errbuf = STRBUF_INIT;
 
        /*
index 979e8b057b165f71ae539d8aefc537989a422ba1..ba3f5607bbbd08f2365c4e82b33da3c533c41d09 100644 (file)
@@ -4216,7 +4216,7 @@ static void prefetch_for_content_merges(struct merge_options *opt,
        struct string_list_item *e;
        struct oid_array to_fetch = OID_ARRAY_INIT;
 
-       if (opt->repo != the_repository || !has_promisor_remote())
+       if (opt->repo != the_repository || !repo_has_promisor_remote(the_repository))
                return;
 
        for (e = &plist->items[plist->nr-1]; e >= plist->items; --e) {
index 79e21ab18e7844461c3743e45ebb7ccc1022caea..4aee73d545f6d65e9bcd9143843e0a137a4173d8 100644 (file)
@@ -2263,7 +2263,7 @@ int is_promisor_object(const struct object_id *oid)
        static int promisor_objects_prepared;
 
        if (!promisor_objects_prepared) {
-               if (has_promisor_remote()) {
+               if (repo_has_promisor_remote(the_repository)) {
                        for_each_packed_object(add_promisor_object,
                                               &promisor_objects,
                                               FOR_EACH_OBJECT_PROMISOR_ONLY |
index df36eb08efc2e194b6fc4f770235fb9707770de6..2cb9eda9ea46a9c004757693fc230dc90cebfc50 100644 (file)
@@ -18,24 +18,9 @@ struct promisor_remote {
 };
 
 void repo_promisor_remote_reinit(struct repository *r);
-static inline void promisor_remote_reinit(void)
-{
-       repo_promisor_remote_reinit(the_repository);
-}
-
 void promisor_remote_clear(struct promisor_remote_config *config);
-
 struct promisor_remote *repo_promisor_remote_find(struct repository *r, const char *remote_name);
-static inline struct promisor_remote *promisor_remote_find(const char *remote_name)
-{
-       return repo_promisor_remote_find(the_repository, remote_name);
-}
-
 int repo_has_promisor_remote(struct repository *r);
-static inline int has_promisor_remote(void)
-{
-       return repo_has_promisor_remote(the_repository);
-}
 
 /*
  * Fetches all requested objects from all promisor remotes, trying them one at
index 3d05e45a279b0b0231da5d9a5829c76818af18bd..b82ad7e45d0115089902a8afaa051c3f5c67f414 100644 (file)
@@ -458,7 +458,7 @@ static int check_updates(struct unpack_trees_options *o,
        if (should_update_submodules())
                load_gitmodules_file(index, &state);
 
-       if (has_promisor_remote())
+       if (repo_has_promisor_remote(the_repository))
                /*
                 * Prefetch the objects that are to be checked out in the loop
                 * below.