ref_update_reject_duplicates(): expose function to whole refs module
It will soon have some other users. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
30173b8851
commit
2ced105cb1
17
refs.c
17
refs.c
@ -1702,6 +1702,23 @@ int create_symref(const char *ref_target, const char *refs_heads_master,
|
||||
refs_heads_master, logmsg);
|
||||
}
|
||||
|
||||
int ref_update_reject_duplicates(struct string_list *refnames,
|
||||
struct strbuf *err)
|
||||
{
|
||||
int i, n = refnames->nr;
|
||||
|
||||
assert(err);
|
||||
|
||||
for (i = 1; i < n; i++)
|
||||
if (!strcmp(refnames->items[i - 1].string, refnames->items[i].string)) {
|
||||
strbuf_addf(err,
|
||||
"multiple updates for ref '%s' not allowed.",
|
||||
refnames->items[i].string);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ref_transaction_prepare(struct ref_transaction *transaction,
|
||||
struct strbuf *err)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user