From: Junio C Hamano Date: Fri, 22 Sep 2017 04:23:07 GMT Subject: Re: [RFC v2] refs: strip out not allowed flags from ref_transaction_update Message-ID: In-Reply-To: <4ae6cb35-ecf4-e2a2-302d-95e1442cf101@alum.mit.edu> Michael Haggerty writes: > 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.