Skip to content

Commit 521331c

Browse files
mhaggergitster
authored andcommitted
struct nonmatching_ref_data: store a refname instead of a ref_entry
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 <[email protected]>
1 parent 385e8af commit 521331c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

refs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ static void prime_ref_dir(struct ref_dir *dir)
843843

844844
struct nonmatching_ref_data {
845845
const struct string_list *skip;
846-
struct ref_entry *found;
846+
const char *conflicting_refname;
847847
};
848848

849849
static int nonmatching_ref_fn(struct ref_entry *entry, void *vdata)
@@ -853,7 +853,7 @@ static int nonmatching_ref_fn(struct ref_entry *entry, void *vdata)
853853
if (data->skip && string_list_has_string(data->skip, entry->name))
854854
return 0;
855855

856-
data->found = entry;
856+
data->conflicting_refname = entry->name;
857857
return 1;
858858
}
859859

@@ -963,7 +963,8 @@ static int is_refname_available(const char *refname,
963963
if (!do_for_each_entry_in_dir(dir, 0, nonmatching_ref_fn, &data))
964964
return 1;
965965

966-
error("'%s' exists; cannot create '%s'", data.found->name, refname);
966+
error("'%s' exists; cannot create '%s'",
967+
data.conflicting_refname, refname);
967968
return 0;
968969
}
969970

0 commit comments

Comments
 (0)