Re: [RFC v2] refs: strip out not allowed flags from ref_transaction_update
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 23 quoted lines
> I wouldn't worry too much about this anomaly. `REF_ISPRUNING` is an ugly
> internal kludge, but allowing it in the mask doesn't make anything worse.
>
>> refs.c | 2 ++
>> refs.h | 8 ++++++++
>> 2 files changed, 10 insertions(+)
>>
>> diff --git a/refs.c b/refs.c
>> index ba22f4acef..fad61be1da 100644
>> --- a/refs.c
>> +++ b/refs.c
>> @@ -921,6 +921,8 @@ int ref_transaction_update(struct ref_transaction *transaction,
>> return -1;
>> }
>>
>> + flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
>> +
>
> I would advocate considering it a bug if the caller passes in options
> that we are going to ignore anyway:
>
> if (flags & ~REF_TRANSACTION_UPDATE_ALLOWED_FLAGS)
> BUG("illegal flags %x in ref_transaction_update", flags);It sounds like a sensible thing to do. Thanks.