public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthew DeVore <matvore@comcast•net>
To: Jeff King <peff@peff•net>
Cc: Matthew DeVore <matvore@google•com>,
	git@vger•kernel.org, gitster@pobox•com, pclouds@gmail•com,
	jonathantanmy@google•com, jeffhost@microsoft•com
Subject: Re: [RFC 2/2] exclude-promisor-objects: declare when option is allowed
Date: Mon, 3 Dec 2018 11:10:49 -0800	[thread overview]
Message-ID: <80a08b99-14cb-e398-e6c2-2aa94a5fdda3@comcast.net> (raw)
In-Reply-To: <20181201194424.GB28918@sigill.intra.peff.net>

On 12/01/2018 11:44 AM, Jeff King wrote:
>>   	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.

> 
>>   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
> 

  reply	other threads:[~2018-12-03 19:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23  1:13 [RFC 0/2] explicitly support or not support --exclude-promisor-objects Matthew DeVore
2018-10-23  1:13 ` [RFC 1/2] Documentation/git-log.txt: do not show --exclude-promisor-objects Matthew DeVore
2018-10-23  1:13 ` [RFC 2/2] exclude-promisor-objects: declare when option is allowed Matthew DeVore
2018-10-23  5:08   ` Junio C Hamano
2018-10-23 17:55     ` Matthew DeVore
2018-10-24  1:31       ` Junio C Hamano
2018-11-21 16:40   ` Jeff King
2018-12-01  1:32     ` Matthew DeVore
2018-12-01 19:44       ` Jeff King
2018-12-03 19:10         ` Matthew DeVore [this message]
2018-12-03 21:15           ` Jeff King
2018-12-03 21:54             ` Matthew DeVore
2018-12-04  2:20             ` Junio C Hamano
2018-12-03 19:23         ` [PATCH] revisions.c: put promisor option in specialized struct Matthew DeVore
2018-12-03 21:24           ` Jeff King
2018-12-03 22:01             ` Matthew DeVore
2018-10-23  1:18 ` [RFC 0/2] explicitly support or not support --exclude-promisor-objects Matthew DeVore
2018-10-23  4:48 ` Junio C Hamano
2018-10-23 17:09   ` Matthew DeVore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80a08b99-14cb-e398-e6c2-2aa94a5fdda3@comcast.net \
    --to=matvore@comcast$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jeffhost@microsoft$(echo .)com \
    --cc=jonathantanmy@google$(echo .)com \
    --cc=matvore@google$(echo .)com \
    --cc=pclouds@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox