refs: replace `refs_for_each_rawref()`
Replace calls to `refs_for_each_rawref()` with the newly introduced `refs_for_each_ref_ext()` function. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
00be226f1f
commit
67034081ad
|
|
@ -641,6 +641,9 @@ int cmd_describe(int argc,
|
|||
const char *prefix,
|
||||
struct repository *repo UNUSED )
|
||||
{
|
||||
struct refs_for_each_ref_options for_each_ref_opts = {
|
||||
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
|
||||
};
|
||||
int contains = 0;
|
||||
struct option options[] = {
|
||||
OPT_BOOL(0, "contains", &contains, N_("find the tag that comes after the commit")),
|
||||
|
|
@ -738,8 +741,8 @@ int cmd_describe(int argc,
|
|||
}
|
||||
|
||||
hashmap_init(&names, commit_name_neq, NULL, 0);
|
||||
refs_for_each_rawref(get_main_ref_store(the_repository), get_name,
|
||||
NULL);
|
||||
refs_for_each_ref_ext(get_main_ref_store(the_repository),
|
||||
get_name, NULL, &for_each_ref_opts);
|
||||
if (!hashmap_get_size(&names) && !always)
|
||||
die(_("No names found, cannot describe anything."));
|
||||
|
||||
|
|
|
|||
|
|
@ -598,6 +598,9 @@ static int fsck_handle_ref(const struct reference *ref, void *cb_data UNUSED)
|
|||
|
||||
static void snapshot_refs(struct snapshot *snap, int argc, const char **argv)
|
||||
{
|
||||
struct refs_for_each_ref_options opts = {
|
||||
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
|
||||
};
|
||||
struct worktree **worktrees, **p;
|
||||
const char *head_points_at;
|
||||
struct object_id head_oid;
|
||||
|
|
@ -623,8 +626,8 @@ static void snapshot_refs(struct snapshot *snap, int argc, const char **argv)
|
|||
return;
|
||||
}
|
||||
|
||||
refs_for_each_rawref(get_main_ref_store(the_repository),
|
||||
snapshot_ref, snap);
|
||||
refs_for_each_ref_ext(get_main_ref_store(the_repository),
|
||||
snapshot_ref, snap, &opts);
|
||||
|
||||
worktrees = get_worktrees();
|
||||
for (p = worktrees; *p; p++) {
|
||||
|
|
|
|||
15
fetch-pack.c
15
fetch-pack.c
|
|
@ -292,11 +292,14 @@ static int next_flush(int stateless_rpc, int count)
|
|||
static void mark_tips(struct fetch_negotiator *negotiator,
|
||||
const struct oid_array *negotiation_tips)
|
||||
{
|
||||
struct refs_for_each_ref_options opts = {
|
||||
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
|
||||
};
|
||||
int i;
|
||||
|
||||
if (!negotiation_tips) {
|
||||
refs_for_each_rawref(get_main_ref_store(the_repository),
|
||||
rev_list_insert_ref_oid, negotiator);
|
||||
refs_for_each_ref_ext(get_main_ref_store(the_repository),
|
||||
rev_list_insert_ref_oid, negotiator, &opts);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -792,8 +795,12 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
|
|||
*/
|
||||
trace2_region_enter("fetch-pack", "mark_complete_local_refs", NULL);
|
||||
if (!args->deepen) {
|
||||
refs_for_each_rawref(get_main_ref_store(the_repository),
|
||||
mark_complete_oid, NULL);
|
||||
struct refs_for_each_ref_options opts = {
|
||||
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
|
||||
};
|
||||
|
||||
refs_for_each_ref_ext(get_main_ref_store(the_repository),
|
||||
mark_complete_oid, NULL, &opts);
|
||||
for_each_cached_alternate(NULL, mark_alternate_complete);
|
||||
if (cutoff)
|
||||
mark_recent_complete_commits(args, cutoff);
|
||||
|
|
|
|||
10
refs.c
10
refs.c
|
|
@ -526,7 +526,10 @@ void refs_warn_dangling_symrefs(struct ref_store *refs, FILE *fp,
|
|||
.indent = indent,
|
||||
.dry_run = dry_run,
|
||||
};
|
||||
refs_for_each_rawref(refs, warn_if_dangling_symref, &data);
|
||||
struct refs_for_each_ref_options opts = {
|
||||
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
|
||||
};
|
||||
refs_for_each_ref_ext(refs, warn_if_dangling_symref, &data, &opts);
|
||||
}
|
||||
|
||||
int refs_for_each_tag_ref(struct ref_store *refs, refs_for_each_cb cb, void *cb_data)
|
||||
|
|
@ -1979,11 +1982,6 @@ int refs_for_each_namespaced_ref(struct ref_store *refs,
|
|||
return refs_for_each_ref_ext(refs, cb, cb_data, &opts);
|
||||
}
|
||||
|
||||
int refs_for_each_rawref(struct ref_store *refs, refs_for_each_cb fn, void *cb_data)
|
||||
{
|
||||
return refs_for_each_rawref_in(refs, "", fn, cb_data);
|
||||
}
|
||||
|
||||
int refs_for_each_rawref_in(struct ref_store *refs, const char *prefix,
|
||||
refs_for_each_cb cb, void *cb_data)
|
||||
{
|
||||
|
|
|
|||
1
refs.h
1
refs.h
|
|
@ -543,7 +543,6 @@ int refs_for_each_namespaced_ref(struct ref_store *refs,
|
|||
refs_for_each_cb fn, void *cb_data);
|
||||
|
||||
/* can be used to learn about broken ref and symref */
|
||||
int refs_for_each_rawref(struct ref_store *refs, refs_for_each_cb fn, void *cb_data);
|
||||
int refs_for_each_rawref_in(struct ref_store *refs, const char *prefix,
|
||||
refs_for_each_cb fn, void *cb_data);
|
||||
|
||||
|
|
|
|||
|
|
@ -3149,6 +3149,9 @@ static int files_transaction_finish_initial(struct files_ref_store *refs,
|
|||
struct ref_transaction *transaction,
|
||||
struct strbuf *err)
|
||||
{
|
||||
struct refs_for_each_ref_options opts = {
|
||||
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
|
||||
};
|
||||
size_t i;
|
||||
int ret = 0;
|
||||
struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
|
||||
|
|
@ -3173,8 +3176,8 @@ static int files_transaction_finish_initial(struct files_ref_store *refs,
|
|||
* so here we really only check that none of the references
|
||||
* that we are creating already exists.
|
||||
*/
|
||||
if (refs_for_each_rawref(&refs->base, ref_present,
|
||||
&transaction->refnames))
|
||||
if (refs_for_each_ref_ext(&refs->base, ref_present,
|
||||
&transaction->refnames, &opts))
|
||||
BUG("initial ref transaction called with existing refs");
|
||||
|
||||
packed_transaction = ref_store_transaction_begin(refs->packed_ref_store,
|
||||
|
|
|
|||
Loading…
Reference in New Issue