From: Junio C Hamano <gitster@pobox.com>
To: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Cc: git@vger.kernel.org, Jakub Narebski <jnareb@gmail.com>,
Petr Baudis <pasky@suse.cz>
Subject: Re: [PATCH] gitweb: fixes to gitweb feature check code
Date: Sun, 16 Nov 2008 13:11:25 -0800 [thread overview]
Message-ID: <7vwsf31ima.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1226759165-6894-1-git-send-email-giuseppe.bilotta@gmail.com> (Giuseppe Bilotta's message of "Sat, 15 Nov 2008 15:26:05 +0100")
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
> The gitweb_check_feature routine was being used for two different
> purposes: retrieving the actual feature value (such as the list of
> snapshot formats or the list of additional actions), and to check if a
> feature was enabled.
> +# check if a given feature is enabled or not, returning the first (and only)
> +# value of the feature. Comfort code, allowing the use of
> +# my $bool_feat = gitweb_check_feature('bool_feat');
> +# or
> +# gitweb_check_feature('bool_feat') or somecode;
> +# instead of
> +# my ($bool_feat) = gitweb_git_feature('bool_feat');
> +# or
> +# (gitweb_check_feature('bool_feat'))[0] or somecode;
> +# respectively
What's "Comfort code"?
I'd agree that introduction of gitweb_get_feature() may help avoiding
mistakes at the call sites for Perl illiterates like myself.
> @@ -767,7 +785,7 @@ our $git_dir;
> $git_dir = "$projectroot/$project" if $project;
>
> # list of supported snapshot formats
> -our @snapshot_fmts = gitweb_check_feature('snapshot');
> +our @snapshot_fmts = gitweb_get_feature('snapshot');
> @snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts);
And this may be a good change from that point of view, but...
> @@ -810,7 +828,7 @@ sub href (%) {
> }
> }
>
> - my ($use_pathinfo) = gitweb_check_feature('pathinfo');
> + my $use_pathinfo = gitweb_check_feature('pathinfo');
... I do not think changes like these are warranted. They have been using
the function _correctly_ by calling it in the list context and I think
they will continue to work with your patch.
next prev parent reply other threads:[~2008-11-16 21:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-15 14:26 [PATCH] gitweb: fixes to gitweb feature check code Giuseppe Bilotta
2008-11-16 15:30 ` Giuseppe Bilotta
2008-11-16 21:11 ` Junio C Hamano [this message]
2008-11-16 21:57 ` Giuseppe Bilotta
2008-11-17 1:02 ` Jakub Narebski
2008-11-17 6:10 ` Giuseppe Bilotta
2008-11-17 9:28 ` Jakub Narebski
2008-11-17 10:09 ` Junio C Hamano
2008-11-17 10:48 ` Jakub Narebski
[not found] <Message-ID: <cb7bb73a0811291731g7f8770f7p89e924c00d2ab004@mail.gmail.com>
2008-11-30 1:31 ` [PATCH 3/3] gitweb: make gitweb_check_feature a boolean wrapper Giuseppe Bilotta
2008-11-30 1:34 ` [PATCH] gitweb: fixes to gitweb feature check code Giuseppe Bilotta
2008-12-02 1:53 ` Jakub Narebski
2008-12-02 21:55 ` Junio C Hamano
2008-12-03 1:21 ` Jakub Narebski
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=7vwsf31ima.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=giuseppe.bilotta@gmail.com \
--cc=jnareb@gmail.com \
--cc=pasky@suse.cz \
/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).