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

Re: [RFC 2/2] exclude-promisor-objects: declare when option is allowed

From
Matthew DeVore <matvore@comcast.net>
Date
Dec 3, 2018, 19:10 UTC
Message-ID
<80a08b99-14cb-e398-e6c2-2aa94a5fdda3@comcast.net>
In-Reply-To
<20181201194424.GB28918@sigill.intra.peff.net>
On 12/01/2018 11:44 AM, Jeff King wrote:
Show 12 quoted lines
>>   	repo_init_revisions(the_repository, &revs, NULL);
>>   	save_commit_buffer = 0;
>> -	revs.allow_exclude_promisor_objects_opt = 1;
>> -	setup_revisions(ac, av, &revs, NULL);
>> +
>> +	memset(&s_r_opt, 0, sizeof(s_r_opt));
>> +	s_r_opt.allow_exclude_promisor_objects = 1;
>> +	setup_revisions(ac, av, &revs, &s_r_opt);
> 
> I wonder if a static initializer for setup_revision_opt is worth it. It
> would remove the need for this memset. Probably not a big deal either
> way, though.
I think you mean something like this:
static struct setup_revision_opt s_r_opt = {NULL, NULL, NULL, 0, 1, 0};

This is a bit cryptic (I have to read the struct declaration in order to know what is being set to 1) and if the struct ever gets a new field before allow_exclude_promisor_objects, this initializer has to be updated.

Show 10 quoted lines
> 
>>   static int handle_revision_opt(struct rev_info *revs, int argc, const char
>> **argv,
>> -			       int *unkc, const char **unkv)
>> +			       int *unkc, const char **unkv,
>> +			       int allow_exclude_promisor_objects)
> 
> Why not pass in the whole setup_revision_opt struct? We don't need
> anything else from it yet, but it seems like the point of that struct is
> to pass around preferences like this.
OK, the code reads better if I do that, so I agree.
> 
> -Peff
> 
Previous: Jeff KingNext: Jeff King
Message 10 of 19 in “[RFC 0/2] explicitly support or not support --exclude-promisor-objects”
  1. Matthew DeVoreOct 23, 2018
  2. 1/2 Documentation/git-log.txt: do not show --exclude-promisor-objectsMatthew DeVore, Oct 23, 2018
  3. 2/2 exclude-promisor-objects: declare when option is allowedMatthew DeVore, Oct 23, 2018
  4. Junio C HamanoOct 23, 2018
  5. Matthew DeVoreOct 23, 2018
  6. Junio C HamanoOct 24, 2018
  7. Jeff KingNov 21, 2018
  8. Matthew DeVoreDec 1, 2018
  9. Jeff KingDec 1, 2018
  10. Matthew DeVoreDec 3, 2018
  11. Jeff KingDec 3, 2018
  12. Matthew DeVoreDec 3, 2018
  13. Junio C HamanoDec 4, 2018
  14. revisions.c: put promisor option in specialized structMatthew DeVore, Dec 3, 2018
  15. Jeff KingDec 3, 2018
  16. Matthew DeVoreDec 3, 2018
  17. Matthew DeVoreOct 23, 2018
  18. Junio C HamanoOct 23, 2018
  19. Matthew DeVoreOct 23, 2018

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.