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 <mhagger@alum.mit.edu>
Michael Haggerty committed
May 11, 2015 at 17:25 UTC
521331cc9f71515e214d0821a35cafd5c03eaad3
1 file changed
+4
-3
refs.c
+4
-3
@@ -843,7 +843,7 @@ static void prime_ref_dir(struct ref_dir *dir)
843
844
struct nonmatching_ref_data {
845
const struct string_list *skip;
846
- struct ref_entry *found;
846
+ const char *conflicting_refname;
847
};
848
849
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)
853
if (data->skip && string_list_has_string(data->skip, entry->name))
854
return 0;
855
856
- data->found = entry;
856
+ data->conflicting_refname = entry->name;
857
return 1;
858
}
859
@@ -963,7 +963,8 @@ static int is_refname_available(const char *refname,
963
if (!do_for_each_entry_in_dir(dir, 0, nonmatching_ref_fn, &data))
964
return 1;
965
966
- error("'%s' exists; cannot create '%s'", data.found->name, refname);
966
+ error("'%s' exists; cannot create '%s'",
967
+ data.conflicting_refname, refname);
968
return 0;
969
}
970