Skip to content

Commit

Permalink
report_refname_conflict(): inline function
Browse files Browse the repository at this point in the history
It wasn't pulling its weight. And we are about to need code similar to
this where no ref_entry is available and with more diverse error
messages. Rather than try to generalize the function, just inline it.

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 8bfac19 commit 385e8af
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,6 @@ static int nonmatching_ref_fn(struct ref_entry *entry, void *vdata)
return 1;
}

static void report_refname_conflict(struct ref_entry *entry,
const char *refname)
{
error("'%s' exists; cannot create '%s'", entry->name, refname);
}

/*
* Return true iff a reference named refname could be created without
* conflicting with the name of an existing reference in dir. If
Expand Down Expand Up @@ -918,7 +912,7 @@ static int is_refname_available(const char *refname,
*/
return 1;
}
report_refname_conflict(entry, refname);
error("'%s' exists; cannot create '%s'", entry->name, refname);
return 0;
}

Expand Down Expand Up @@ -969,7 +963,7 @@ static int is_refname_available(const char *refname,
if (!do_for_each_entry_in_dir(dir, 0, nonmatching_ref_fn, &data))
return 1;

report_refname_conflict(data.found, refname);
error("'%s' exists; cannot create '%s'", data.found->name, refname);
return 0;
}

Expand Down

0 comments on commit 385e8af

Please sign in to comment.