From: Junio C Hamano <junkio@cox.net>
To: Frank Lichtenheld <frank@lichtenheld.de>
Cc: git@vger.kernel.org, Martin Langhoff <martin.langhoff@gmail.com>
Cc: Petr Baudis <pasky@suse.cz>
Subject: Re: [PATCH] cvsserver: Complete rewrite of the configuration parser
Date: Sat, 12 May 2007 12:59:49 -0700 [thread overview]
Message-ID: <7v4pmhyfre.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <11789982521112-git-send-email-frank@lichtenheld.de> (Frank Lichtenheld's message of "Sat, 12 May 2007 21:30:52 +0200")
Frank Lichtenheld <frank@lichtenheld.de> writes:
> Maybe a bit overkill if one only wants to solve the problem Junio discovered
> but I believe it's still worthwile.
>
> Has a lot of overlap with perl/Git.pm though...
>
> Not extensively tested but it at least passes the test cases and creates a useful
> log which should take care of the two main code paths (get_gitcvs and
> get_gitcvs_bool).
I agree that the general direction should be to do something
like this in perl/Git.pm (Pasky CC'ed). As there are some
things that current Git.pm config interface does not offer an
easy access to what you would want to do, we need to enumerate
what you need, decide if they are of general interest and design
what to put in Git.pm and what to implement in GITCVS::config as
a special-purpose feature.
perl/Git.pm currently gives us only this:
- grab all values for a named variable, in an array;
- return canonicalized value for a named boolean variable;
GITCVS::config wants to read *everything* from config and
returns a 'config' instance you can:
- enumerate keys (you do not have this, but it is easy to add);
- retrieve a value for a key (either one- or two-level);
- retrieve a canonicalized bool value for a key (either one- or
two-level);
- treat a request for "gitcvs.method.option" variable to fall
back on "gitcvs.option" if the former is not given;
- the same for boolean variant.
I think the best abstraction is to have the "read everything"
interface in perl/Git.pm side, make the current Git::config()
and Git::config_bool() interface to use it (without issuing
extra 'git config --get-all'). I am not sure it is common for
Git.pm users to want the behaviour of "section.method.option"
falling back to "section.option", but if it is common enough, it
probably is a good idea to have:
sub config_fallback {
my ($self, $section, $specific, $var) = @_;
my $cfg = $self->config();
if (exists $cfg{"$section.$specific.$var"}) {
return $cfg{"$section.$specific.$var"};
}
if (exists $cfg{"$section.$var"}) {
return $cfg{"$section.$var"};
}
return undef;
}
on perl/Git.pm side.
But all of this is post 1.5.2 material; we would want to have a
minimal fixup on 'master' before 1.5.2, independent of this
rewrite.
next prev parent reply other threads:[~2007-05-12 20:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-11 23:35 [PATCH] t9400: Use the repository config and nothing else Junio Hamano
2007-05-12 16:28 ` Frank Lichtenheld
2007-05-12 16:31 ` Junio C Hamano
2007-05-12 17:21 ` Junio C Hamano
2007-05-12 19:36 ` Frank Lichtenheld
2007-05-12 19:30 ` [PATCH] cvsserver: Complete rewrite of the configuration parser Frank Lichtenheld
2007-05-12 19:59 ` Junio C Hamano [this message]
2007-05-12 21:31 ` Frank Lichtenheld
2007-05-12 22:43 ` Junio C Hamano
2007-05-13 0:16 ` [PATCH] cvsserver: Limit config parser to needed options Frank Lichtenheld
2007-05-13 19:16 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v4pmhyfre.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=frank@lichtenheld.de \
--cc=git@vger.kernel.org \
--cc=martin.langhoff@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.
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).