git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC v2] refs: strip out not allowed flags from ref_transaction_update

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 22, 2017, 04:23 UTC
Message-ID
<xmqq8th7l5uc.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<4ae6cb35-ecf4-e2a2-302d-95e1442cf101@alum.mit.edu>
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.
Previous: Michael HaggertyNext: Thomas Gummerer
Message 11 of 12 in “refs: make sure we never pass NULL to hashcpy”
  1. refs: make sure we never pass NULL to hashcpyThomas Gummerer, Sep 4, 2017
  2. Junio C HamanoSep 6, 2017
  3. Thomas GummererSep 6, 2017
  4. Michael HaggertySep 7, 2017
  5. Thomas GummererSep 7, 2017
  6. Junio C HamanoSep 8, 2017
  7. Michael HaggertySep 8, 2017
  8. Junio C HamanoSep 8, 2017
  9. [RFC v2] refs: strip out not allowed flags from ref_transaction_updateThomas Gummerer, Sep 12, 2017
  10. Michael HaggertySep 21, 2017
  11. Junio C HamanoSep 22, 2017
  12. Thomas GummererSep 24, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.