clean up interface for refs_warn_dangling_symrefs

The refs_warn_dangling_symrefs interface is a bit fragile as it passes
in printf-formatting strings with expectations about the number of
arguments. This patch series made it worse by adding a 2nd positional
argument. But there are only two call sites, and they both use almost
identical display options.

Make this safer by moving the format strings into the function that uses
them to make it easier to see when the arguments don't match. Pass a
prefix string and a dry_run flag so the decision logic can be handled
where needed.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Phil Hord
2025-07-01 18:12:15 -07:00
committed by Junio C Hamano
parent 0f84695499
commit 87d8d8c5d0
4 changed files with 15 additions and 15 deletions

3
refs.h
View File

@@ -436,7 +436,8 @@ static inline const char *has_glob_specials(const char *pattern)
}
void refs_warn_dangling_symrefs(struct ref_store *refs, FILE *fp,
const char *msg_fmt, const struct string_list *refnames);
const char *indent, int dry_run,
const struct string_list *refnames);
/*
* Flags for controlling behaviour of pack_refs()