From: MATTHEW DEVORE <matvore@comcast.net>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: matvore@google.com, git@vger.kernel.org, sbeller@google.com,
git@jeffhostetler.com, jeffhost@microsoft.com, peff@peff.net,
stefanbeller@gmail.com, pclouds@gmail.com
Subject: Re: [PATCH v2 2/2] tree:<depth>: skip some trees even when collecting omits
Date: Tue, 8 Jan 2019 18:47:04 -0800 (PST) [thread overview]
Message-ID: <1446107549.183303.1547002024564@connect.xfinity.com> (raw)
In-Reply-To: <20190108232251.37748-1-jonathantanmy@google.com>
> On January 8, 2019 at 3:22 PM Jonathan Tan <jonathantanmy@google.com> wrote:
>
>
> > > -static void filter_trees_update_omits(
> > > +static int filter_trees_update_omits(
> > > struct object *obj,
> > > struct filter_trees_depth_data *filter_data,
> > > int include_it)
> > > {
> > > if (!filter_data->omits)
> > > - return;
> > > + return 1;
> > >
> > > if (include_it)
> > > - oidset_remove(filter_data->omits, &obj->oid);
> > > + return oidset_remove(filter_data->omits, &obj->oid);
> > > else
> > > - oidset_insert(filter_data->omits, &obj->oid);
> > > + return oidset_insert(filter_data->omits, &obj->oid);
> > > }
> >
> > I think this function is getting too magical - if filter_data->omits is
> > not set, we pretend that we have omitted the tree, because we want the
> > same behavior when not needing omits and when the tree is omitted. Could
> > this be done another way?
>
> Giving some more thought to this, since this is a static function, maybe
> documenting it as "Returns 1 if the objects that this object references need to
> be traversed for "omits" updates, and 0 otherwise" (with the appropriate code
> updates) would suffice.
That's not bad. But I sent a correction which is more like "/* Returns 1 if the oid was in the omits set before it was invoked. */" and returns 0 if omits was NULL. I thought it clearer when the function returns a value in terms of its own arguments and logic, rather than what the caller needs to do. The code I save going with your suggestion (vs. the one I just sent) is offset by the necessity of more detailed comments.
next prev parent reply other threads:[~2019-01-09 2:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 23:40 [PATCH v2 0/2] support for filtering trees and blobs based on depth Matthew DeVore
2018-12-10 23:40 ` [PATCH v2 1/2] list-objects-filter: teach tree:# how to handle >0 Matthew DeVore
2019-01-08 1:56 ` Jonathan Tan
2019-01-08 19:22 ` Matthew DeVore
2019-01-08 23:19 ` Jonathan Tan
2019-01-08 23:36 ` Junio C Hamano
2019-01-08 23:41 ` Jonathan Tan
2019-01-08 23:39 ` Junio C Hamano
2019-01-09 2:43 ` MATTHEW DEVORE
2018-12-10 23:40 ` [PATCH v2 2/2] tree:<depth>: skip some trees even when collecting omits Matthew DeVore
2019-01-08 2:00 ` Jonathan Tan
2019-01-08 23:22 ` Jonathan Tan
2019-01-09 2:47 ` MATTHEW DEVORE [this message]
2019-01-09 0:29 ` Matthew DeVore
2018-12-11 8:45 ` [PATCH v2 0/2] support for filtering trees and blobs based on depth Junio C Hamano
2019-01-08 0:56 ` Matthew DeVore
2019-01-09 2:59 ` [PATCH v3 " Matthew DeVore
2019-01-09 2:59 ` [PATCH v3 1/2] list-objects-filter: teach tree:# how to handle >0 Matthew DeVore
2019-01-09 2:59 ` [PATCH v3 2/2] tree:<depth>: skip some trees even when collecting omits Matthew DeVore
2019-01-09 18:06 ` [PATCH v3 0/2] support for filtering trees and blobs based on depth Jonathan Tan
2019-01-15 23:35 ` Junio C Hamano
2019-01-15 23:41 ` Junio C Hamano
2019-01-17 0:14 ` Matthew DeVore
2019-01-17 18:44 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446107549.183303.1547002024564@connect.xfinity.com \
--to=matvore@comcast.net \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=jeffhost@microsoft.com \
--cc=jonathantanmy@google.com \
--cc=matvore@google.com \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.com \
--cc=stefanbeller@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).