From: Michael Haggerty Date: Fri, 01 May 2015 12:25:47 GMT Subject: [PATCH 07/18] struct nonmatching_ref_data: store a refname instead of a ref_entry Message-ID: <1430483158-14349-8-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1430483158-14349-1-git-send-email-mhagger@alum.mit.edu> Now that we don't need a ref_entry to pass to report_refname_conflict(), it is sufficient to store the refname of the conflicting reference. Signed-off-by: Michael Haggerty --- refs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index f1da87b..0ec3f0a 100644 --- a/refs.c +++ b/refs.c @@ -848,7 +848,7 @@ static void prime_ref_dir(struct ref_dir *dir) struct nonmatching_ref_data { const struct string_list *skip; - struct ref_entry *found; + const char *conflicting_refname; }; static int nonmatching_ref_fn(struct ref_entry *entry, void *vdata) @@ -858,7 +858,7 @@ static int nonmatching_ref_fn(struct ref_entry *entry, void *vdata) if (data->skip && string_list_has_string(data->skip, entry->name)) return 0; - data->found = entry; + data->conflicting_refname = entry->name; return 1; } @@ -950,7 +950,8 @@ static int is_refname_available(const char *refname, if (!do_for_each_entry_in_dir(dir, 0, nonmatching_ref_fn, &data)) return 1; - error("'%s' exists; cannot create '%s'", data.found->name, refname); + error("'%s' exists; cannot create '%s'", + data.conflicting_refname, refname); return 0; } -- 2.1.4