Skip to content

Commit 385e8af

Browse files
mhaggergitster
authored andcommitted
report_refname_conflict(): inline function
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 <[email protected]>
1 parent 8bfac19 commit 385e8af

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

refs.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -857,12 +857,6 @@ static int nonmatching_ref_fn(struct ref_entry *entry, void *vdata)
857857
return 1;
858858
}
859859

860-
static void report_refname_conflict(struct ref_entry *entry,
861-
const char *refname)
862-
{
863-
error("'%s' exists; cannot create '%s'", entry->name, refname);
864-
}
865-
866860
/*
867861
* Return true iff a reference named refname could be created without
868862
* conflicting with the name of an existing reference in dir. If
@@ -918,7 +912,7 @@ static int is_refname_available(const char *refname,
918912
*/
919913
return 1;
920914
}
921-
report_refname_conflict(entry, refname);
915+
error("'%s' exists; cannot create '%s'", entry->name, refname);
922916
return 0;
923917
}
924918

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

972-
report_refname_conflict(data.found, refname);
966+
error("'%s' exists; cannot create '%s'", data.found->name, refname);
973967
return 0;
974968
}
975969

0 commit comments

Comments
 (0)