refs: refuse to write pseudorefs
Pseudorefs are not stored in the ref database as by definition, they carry additional metadata that essentially makes them not a ref. As such, writing pseudorefs via the ref backend does not make any sense whatsoever as the ref backend wouldn't know how exactly to store the data. Restrict writing pseudorefs via the ref backend. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f1701f279a
commit
8e4f5c2dc2
7
refs.c
7
refs.c
@ -1263,6 +1263,13 @@ int ref_transaction_update(struct ref_transaction *transaction,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(flags & REF_SKIP_REFNAME_VERIFICATION) &&
|
||||
is_pseudo_ref(refname)) {
|
||||
strbuf_addf(err, _("refusing to update pseudoref '%s'"),
|
||||
refname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & ~REF_TRANSACTION_UPDATE_ALLOWED_FLAGS)
|
||||
BUG("illegal flags 0x%x passed to ref_transaction_update()", flags);
|
||||
|
||||
|
Reference in New Issue
Block a user