summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-05-11 17:25:09 +0200
committerJunio C Hamano <gitster@pobox.com>2015-05-11 11:50:18 -0700
commit521331cc9f71515e214d0821a35cafd5c03eaad3 (patch)
tree9d2e41d6b835cf087ef5a2d4c70c7c87276b5f22 /refs.c
parent385e8af5a2d1056b75428eea810bce65d2c83363 (diff)
downloadgit-521331cc9f71515e214d0821a35cafd5c03eaad3.tar.gz
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index 74225943b6..effd91a2ed 100644
--- a/refs.c
+++ b/refs.c
@@ -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)
@@ -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;
}
@@ -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;
}