From: karthik nayak <karthik.188@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, matthieu.moy@grenoble-inp.fr,
christian.couder@gmail.com
Subject: Re: [PATCH 3/4] for-each-ref: convert to ref-filter
Date: Thu, 21 May 2015 12:21:44 +0530 [thread overview]
Message-ID: <555D8080.1020504@gmail.com> (raw)
In-Reply-To: <xmqqvbfmlsfu.fsf@gitster.dls.corp.google.com>
On 05/21/2015 05:20 AM, Junio C Hamano wrote:
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>> convert 'for-each-ref' to use the common API provided by 'ref-filter'.
>
> Start a sentence with capital?
>
> More importantly, the above is misleading, as if you invented a new
> ref-filter API and made for-each-ref build on that new
> infrastructure.
>
> This series is in a form that is very unfriendly to reviewers. The
> previous step did not introduce any callers to ref-filter, so for
> the purpose of review, it needs to be read together with this step
> anyway.
>
> And when reading these patches that way, what this half is really
> doing is to move the code from for-each-ref to ref-filter, but it
> does unnecessary or unrelated renaming of a handful of symbols. It
> makes it even harder to compare and contrast the original code that
> was in the original for-each-ref and moved code that ends up in the
> new ref-filter. Don't do that.
>
> You would probably want to organize them in these two steps instead:
>
> * Rename symbols as necessary while all the code is still in
> for-each-ref. Do not create ref-filter in this step. Justify it
> along the lines of "some symbol names were fine while they were
> file scope static implementation detail of for-each-ref, but we
> will make the machinery available from other commands by moving
> it to a library-ish place, so rename X to foo_X to clarify that
> this is about foo (which is now necessary as it is not specific
> to for-each-ref"...
>
> * If you want to do other tweaks like wrapping refs & num_refs into
> a single structure, do so while the code is still in
> for-each-ref. You can do that in the same patch as the above
> (i.e. it's just part of preparatory step for a move).
>
> * Create ref-filter by _moving_ code from for-each-ref. Do not
> touch these moved lines in this step. You would need to add
> include at the top of for-each-ref and ref-filter, of course.
>
Thanks for the suggestion's Junio, will follow with the path you've
mentioned.
>
>> - for_each_rawref(grab_single_ref, &cbdata);
>> - refs = cbdata.grab_array;
>> - num_refs = cbdata.grab_cnt;
>> + refs.name_patterns = argv;
>> + for_each_rawref(ref_filter_add, &refs);
>
> I think ref_filter_add() may be misnamed as a public API function.
> grab_single_ref() was OK only because it was an implementation
> dtail, but if you are making it public, the name should make it
> clear that it is meant to be used as a for_each_*ref() callback
> function. Otherwise people may be tempted to add random parameter
> to it in the future, but the signature of that function is dictated
> by for_each_*ref() API.
>
Looking through the current each_ref_f() names, I thought I could use
'ref_filter_handler()' instead of 'ref_filter_add()', as per your
suggestion. What do you think?
next prev parent reply other threads:[~2015-05-21 6:51 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
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 [this message]
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=555D8080.1020504@gmail.com \
--to=karthik.188@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=matthieu.moy@grenoble-inp.fr \
/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).