From: Jay Soffian <jaysoffian@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Marc Branchaud <marcnarc@xiplink.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 12/13] remote.c: refactor get_remote_ref_states()
Date: Mon, 23 Feb 2009 02:55:32 -0500 [thread overview]
Message-ID: <76718490902222355v7510d2f9p51ade61d1f257146@mail.gmail.com> (raw)
In-Reply-To: <20090223065048.GC24517@coredump.intra.peff.net>
On Mon, Feb 23, 2009 at 1:50 AM, Jeff King <peff@peff.net> wrote:
> On Mon, Feb 23, 2009 at 01:29:00AM -0500, Jay Soffian wrote:
>
>> get_remote_ref_states() has three callers, but each is interested in
>> slightly different information. Give it a bit-field flag so that callers
>> can specify which pieces of information they need.
>
> Hmph. I think this is probably an indication that
> get_remote_ref_states() should really be 3 functions:
>
> common_stuff();
> query_one();
> query_two();
>
> and then callers can choose the subset they are interested in.
>
> Which is really more or less equivalent; it just seems like extra
> obfuscation to have a single function with a bit-field.
I see your hmph and raise you a hmph. :-)
Well, I _had_ tried as you suggested first, and thought it yuckier. It
would actually be more like:
caller1() {
setup_for_get();
get_thing_one();
}
caller2() {
setup_for_get();
get_thing_two();
}
caller3() {
if (query) {
setup_for_get();
get_thing_one();
get_thing_two();
get_thing_three();
} else {
get_thing_one_noquery()
get_thing_two_noquery();
}
As opposed to:
caller1() {
get_things(ONE)
}
caller2() {
get_things(TWO)
}
caller3() {
things = 0;
if (query)
things = (ONE|TWO|THREE)
get_things(things)
}
I'm not sure why passing a flag saying what you want is obfuscating.
Also, I did find other places in git that do this sort of thing (e.g.,
get_remote_heads).
(Awaiting Junio's lucid reply explaining why my justification is bogus.) :-)
j.
next prev parent reply other threads:[~2009-02-23 7:57 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-23 6:28 [PATCH 00/13] New output style for git remote show Jay Soffian
2009-02-23 6:28 ` [PATCH 01/13] remote: rename variable and eliminate redundant function call Jay Soffian
2009-02-23 6:28 ` [PATCH 02/13] remote: remove unused code in get_ref_states Jay Soffian
2009-02-23 6:28 ` [PATCH 03/13] remote: fix two inconsistencies in the output of "show <remote>" Jay Soffian
2009-02-23 6:28 ` [PATCH 04/13] remote: make get_remote_ref_states() always populate states.tracked Jay Soffian
2009-02-24 1:34 ` Junio C Hamano
2009-02-24 3:09 ` Jay Soffian
2009-02-24 3:13 ` Jay Soffian
2009-02-23 6:28 ` [PATCH 05/13] remote: name remote_refs consistently Jay Soffian
2009-02-23 6:28 ` [PATCH 06/13] string-list: new for_each_string_list() function Jay Soffian
2009-02-23 6:28 ` [PATCH 07/13] remote: new show output style Jay Soffian
2009-02-23 6:46 ` Jeff King
2009-02-23 23:11 ` Marc Branchaud
2009-02-23 6:28 ` [PATCH 08/13] refactor duplicated get_local_heads() to remote.c Jay Soffian
2009-02-23 6:28 ` [PATCH 09/13] refactor duplicated ref_newer() " Jay Soffian
2009-02-23 6:45 ` Jeff King
2009-02-23 7:29 ` [PATCH v2 " Jay Soffian
2009-02-23 8:53 ` Johannes Sixt
2009-02-23 13:41 ` Jay Soffian
2009-02-23 6:28 ` [PATCH 10/13] remote.c: make match_refs() copy src ref before assigning to peer_ref Jay Soffian
2009-02-24 1:34 ` Junio C Hamano
2009-02-24 3:06 ` Jay Soffian
2009-02-24 3:23 ` Junio C Hamano
2009-02-24 4:05 ` [PATCH] " Jay Soffian
2009-02-24 6:17 ` Junio C Hamano
2009-02-24 6:53 ` Jay Soffian
2009-02-24 7:12 ` Junio C Hamano
2009-02-23 6:28 ` [PATCH 11/13] remote.c: don't short-circuit match_refs() when error in match_explicit_refs() Jay Soffian
2009-02-24 1:34 ` Junio C Hamano
2009-02-24 3:07 ` Jay Soffian
2009-02-23 6:29 ` [PATCH 12/13] remote.c: refactor get_remote_ref_states() Jay Soffian
2009-02-23 6:50 ` Jeff King
2009-02-23 7:55 ` Jay Soffian [this message]
2009-02-23 8:31 ` Jay Soffian
2009-02-24 1:05 ` Jeff King
2009-02-23 6:29 ` [PATCH 13/13] remote: new show output style for push refspecs Jay Soffian
2009-02-23 6:59 ` [PATCH 00/13] New output style for git remote show Jeff King
2009-02-23 7:56 ` Jay Soffian
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=76718490902222355v7510d2f9p51ade61d1f257146@mail.gmail.com \
--to=jaysoffian@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=marcnarc@xiplink.com \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).