git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: karthik nayak <karthik.188@gmail.com>,
	git@vger.kernel.org, christian.couder@gmail.com
Subject: Re: [PATCH 2/4] ref-filter: add ref-filter API
Date: Sat, 23 May 2015 10:18:04 -0700	[thread overview]
Message-ID: <xmqqoalbciwj.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <vpq8ucffj8h.fsf@anie.imag.fr> (Matthieu Moy's message of "Sat, 23 May 2015 16:42:38 +0200")

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> But I think this could be clearer in the code (and/or comment + commit
> message). Perhaps stg like:
>
> struct ref_filter_data /* Probably not the best name */ {
>         struct ref_list list;
>         struct ref_filter filter;
> };
>
> struct ref_list {
>  	int count, alloc;
>  	struct ref_filter_item **items;
> };

If you plan to use ALLOC_GROW() API, name the bookkeeping variables
"alloc" & "nr", unless you have a compelling reason to deviate from
the prevailing practice.

> struct ref_filter {
> 	const char **name_patterns;
> 	/* There will be more here later */
> };

Very good suggestion.

Whatever the final name would be, it is a good idea to separate the
"list of things that are operated on" and the "set of operations to
be applied".  That makes things conceptually cleaner; you can have
multiple of the former operated on with a singleton of the latter
and then their results merged, etc. etc.

And I do not think an array of things that are operated on should
not be named "ref_filter_item".

Surely, the latter "set of operations to be applied" may currently
be only filtering, but who says it has to stay that way?  "I have a
set of refs that represent my local branches I am interested
in. Please map them to their corresponding @{upstream}" is a
reasonable request once you have an infrastructure to represent "set
of refs to be worked on" and "set of operations to apply", and at
that point, the items are no longer filter-items (map-items?).

  parent reply	other threads:[~2015-05-23 17:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 13:14 [WIP] [PATCH 0/4] Unifying git branch -l, git tag -l, and git for-each-ref karthik nayak
2015-05-20 13:18 ` [PATCH 1/4] for-each-ref: rename refinfo members to match similar structures Karthik Nayak
2015-05-20 16:57   ` Matthieu Moy
2015-05-21  6:27     ` karthik nayak
2015-05-20 13:18 ` [PATCH 2/4] ref-filter: add ref-filter API Karthik Nayak
2015-05-20 19:07   ` Eric Sunshine
2015-05-21 17:30     ` karthik nayak
2015-05-21 18:40       ` Eric Sunshine
2015-05-22 12:30         ` karthik nayak
2015-05-21  8:47   ` Matthieu Moy
2015-05-21 17:22     ` karthik nayak
2015-05-21 17:59     ` karthik nayak
2015-05-22  6:44       ` Matthieu Moy
2015-05-22 12:46         ` karthik nayak
2015-05-23 14:42           ` Matthieu Moy
2015-05-23 16:04             ` Christian Couder
2015-05-23 17:00               ` Matthieu Moy
2015-05-23 17:18             ` Junio C Hamano [this message]
2015-05-23 22:33               ` Matthieu Moy
2015-05-23 17:52             ` Karthik Nayak
2015-05-20 13:18 ` [PATCH 3/4] for-each-ref: convert to ref-filter Karthik Nayak
2015-05-20 23:50   ` Junio C Hamano
2015-05-21  6:51     ` karthik nayak
2015-05-20 13:18 ` [PATCH 4/4] ref-filter: move formatting/sorting options from 'for-each-ref' Karthik Nayak

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=xmqqoalbciwj.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@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).