Skip to content

Commit a5183d7

Browse files
avargitster
authored andcommitted
cocci: apply the "promisor-remote.h" part of "the_repository.pending"
Apply the part of "the_repository.pending.cocci" pertaining to "promisor-remote.h". Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent afe27c8 commit a5183d7

18 files changed

+32
-46
lines changed

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ static int batch_objects(struct batch_options *opt)
792792
if (!memcmp(&data.info, &empty, sizeof(empty)))
793793
data.skip_object_info = 1;
794794

795-
if (has_promisor_remote())
795+
if (repo_has_promisor_remote(the_repository))
796796
warning("This repository uses promisor remotes. Some objects may not be loaded.");
797797

798798
read_replace_refs = 0;

builtin/fetch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)
20082008
* If no prior partial clone/fetch and the current fetch DID NOT
20092009
* request a partial-fetch, do a normal fetch.
20102010
*/
2011-
if (!has_promisor_remote() && !filter_options.choice)
2011+
if (!repo_has_promisor_remote(the_repository) && !filter_options.choice)
20122012
return;
20132013

20142014
/*
@@ -2264,7 +2264,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
22642264
printf("%s\n", oid_to_hex(oid));
22652265
oidset_clear(&acked_commits);
22662266
} else if (remote) {
2267-
if (filter_options.choice || has_promisor_remote())
2267+
if (filter_options.choice || repo_has_promisor_remote(the_repository))
22682268
fetch_one_setup_partial(remote);
22692269
result = fetch_one(remote, argc, argv, prune_tags_ok, stdin_refspecs);
22702270
} else {

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
699699
strvec_push(&prune, prune_expire);
700700
if (quiet)
701701
strvec_push(&prune, "--no-progress");
702-
if (has_promisor_remote())
702+
if (repo_has_promisor_remote(the_repository))
703703
strvec_push(&prune,
704704
"--exclude-promisor-objects");
705705
prune_cmd.git_cmd = 1;

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ static void fix_unresolved_deltas(struct hashfile *f)
13901390
sorted_by_pos[i] = &ref_deltas[i];
13911391
QSORT(sorted_by_pos, nr_ref_deltas, delta_pos_compare);
13921392

1393-
if (has_promisor_remote()) {
1393+
if (repo_has_promisor_remote(the_repository)) {
13941394
/*
13951395
* Prefetch the delta bases.
13961396
*/

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,7 @@ static void check_object(struct object_entry *entry, uint32_t object_index)
20782078

20792079
if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
20802080
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0) {
2081-
if (has_promisor_remote()) {
2081+
if (repo_has_promisor_remote(the_repository)) {
20822082
prefetch_to_pack(object_index);
20832083
if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
20842084
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0)

builtin/repack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
901901
strvec_push(&cmd.args, "--reflog");
902902
strvec_push(&cmd.args, "--indexed-objects");
903903
}
904-
if (has_promisor_remote())
904+
if (repo_has_promisor_remote(the_repository))
905905
strvec_push(&cmd.args, "--exclude-promisor-objects");
906906
if (!write_midx) {
907907
if (write_bitmaps > 0)

cache-tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ int cache_tree_fully_valid(struct cache_tree *it)
240240

241241
static int must_check_existence(const struct cache_entry *ce)
242242
{
243-
return !(has_promisor_remote() && ce_skip_worktree(ce));
243+
return !(repo_has_promisor_remote(the_repository) && ce_skip_worktree(ce));
244244
}
245245

246246
static int update_one(struct cache_tree *it,
@@ -470,7 +470,7 @@ int cache_tree_update(struct index_state *istate, int flags)
470470
if (!istate->cache_tree)
471471
istate->cache_tree = cache_tree();
472472

473-
if (!(flags & WRITE_TREE_MISSING_OK) && has_promisor_remote())
473+
if (!(flags & WRITE_TREE_MISSING_OK) && repo_has_promisor_remote(the_repository))
474474
prefetch_cache_entries(istate, must_check_existence);
475475

476476
trace_performance_enter();

connected.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
5454
strbuf_release(&idx_file);
5555
}
5656

57-
if (has_promisor_remote()) {
57+
if (repo_has_promisor_remote(the_repository)) {
5858
/*
5959
* For partial clones, we don't want to have to do a regular
6060
* connectivity check because we have to enumerate and exclude
@@ -97,7 +97,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
9797
strvec_push(&rev_list.args,"rev-list");
9898
strvec_push(&rev_list.args, "--objects");
9999
strvec_push(&rev_list.args, "--stdin");
100-
if (has_promisor_remote())
100+
if (repo_has_promisor_remote(the_repository))
101101
strvec_push(&rev_list.args, "--exclude-promisor-objects");
102102
if (!opt->is_deepening_fetch) {
103103
strvec_push(&rev_list.args, "--not");

contrib/coccinelle/the_repository.cocci

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@
9595
|
9696
- approximate_object_count
9797
+ repo_approximate_object_count
98+
// promisor-remote.h
99+
|
100+
- promisor_remote_reinit
101+
+ repo_promisor_remote_reinit
102+
|
103+
- promisor_remote_find
104+
+ repo_promisor_remote_find
105+
|
106+
- has_promisor_remote
107+
+ repo_has_promisor_remote
98108
)
99109
(
100110
+ the_repository,

contrib/coccinelle/the_repository.pending.cocci

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,7 @@
55
@@
66
@@
77
(
8-
// promisor-remote.h
9-
- promisor_remote_reinit
10-
+ repo_promisor_remote_reinit
11-
|
12-
- promisor_remote_find
13-
+ repo_promisor_remote_find
14-
|
15-
- has_promisor_remote
16-
+ repo_has_promisor_remote
178
// refs.h
18-
|
199
- dwim_ref
2010
+ repo_dwim_ref
2111
// rerere.h

0 commit comments

Comments
 (0)