Skip to content

Commit

Permalink
struct nonmatching_ref_data: store a refname instead of a ref_entry
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed May 11, 2015
1 parent 385e8af commit 521331c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,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)
Expand All @@ -853,7 +853,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;
}

Expand Down Expand Up @@ -963,7 +963,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;
}

Expand Down

0 comments on commit 521331c

Please sign in to comment.