Skip to content

Commit 5ef6d59

Browse files
pks-tgitster
authored andcommitted
refs: replace refs_for_each_rawref_in()
Replace calls to `refs_for_each_rawref_in()` 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>
1 parent 6703408 commit 5ef6d59

3 files changed

Lines changed: 6 additions & 16 deletions

File tree

builtin/remote.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,9 @@ static int mv(int argc, const char **argv, const char *prefix,
912912
old_remote_context.buf);
913913

914914
if (refspecs_need_update) {
915+
struct refs_for_each_ref_options opts = {
916+
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
917+
};
915918
rename.transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
916919
0, &err);
917920
if (!rename.transaction)
@@ -923,9 +926,10 @@ static int mv(int argc, const char **argv, const char *prefix,
923926

924927
strbuf_reset(&buf);
925928
strbuf_addf(&buf, "refs/remotes/%s/", rename.old_name);
929+
opts.prefix = buf.buf;
926930

927-
result = refs_for_each_rawref_in(get_main_ref_store(the_repository), buf.buf,
928-
rename_one_ref, &rename);
931+
result = refs_for_each_ref_ext(get_main_ref_store(the_repository),
932+
rename_one_ref, &rename, &opts);
929933
if (result < 0)
930934
die(_("queueing remote ref renames failed: %s"), rename.err->buf);
931935

refs.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,16 +1982,6 @@ int refs_for_each_namespaced_ref(struct ref_store *refs,
19821982
return refs_for_each_ref_ext(refs, cb, cb_data, &opts);
19831983
}
19841984

1985-
int refs_for_each_rawref_in(struct ref_store *refs, const char *prefix,
1986-
refs_for_each_cb cb, void *cb_data)
1987-
{
1988-
struct refs_for_each_ref_options opts = {
1989-
.prefix = prefix,
1990-
.flags = REFS_FOR_EACH_INCLUDE_BROKEN,
1991-
};
1992-
return refs_for_each_ref_ext(refs, cb, cb_data, &opts);
1993-
}
1994-
19951985
static int qsort_strcmp(const void *va, const void *vb)
19961986
{
19971987
const char *a = *(const char **)va;

refs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,6 @@ int refs_for_each_namespaced_ref(struct ref_store *refs,
542542
const char **exclude_patterns,
543543
refs_for_each_cb fn, void *cb_data);
544544

545-
/* can be used to learn about broken ref and symref */
546-
int refs_for_each_rawref_in(struct ref_store *refs, const char *prefix,
547-
refs_for_each_cb fn, void *cb_data);
548-
549545
/*
550546
* Normalizes partial refs to their fully qualified form.
551547
* Will prepend <prefix> to the <pattern> if it doesn't start with 'refs/'.

0 commit comments

Comments
 (0)