git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] git.c: binary-search builtin commands
Date: Tue, 15 Feb 2011 12:12:48 -0800	[thread overview]
Message-ID: <7v4o85njjz.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1297739344-28961-2-git-send-email-pclouds@gmail.com

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> An obvious implication of this patch: commands array must be in correct
> order.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>   2011/2/15 Junio C Hamano <gitster@pobox.com>:
>   > I did this myself the other day, as I think it simply is a good project
>   > hygiene.  If this were 1/2 of a series followed by 2/2 that runs binary
>   > search in the table, that would make it make more sense ;-)
>   
>   I did think the array was binary-searched and nearly claimed "git-stage
>   won't work because it's in wrong order".

Heh, that "binary search" was a tongue-in-cheek comment.  I am sorry that
you took it too seriously.

>   This patch won't give any performance gain, but it would force
>   people to keep the array in order :-)

That is exactly why I discarded what I did the other day.  Without an
active mechanism to force the orderedness, such a change simply introduces
a downside of letting a mistake go unnoticed, without any real upside (as
you measured and saw no performance gain).

A better project hygine is a good thing to aim for, and I would imagine
that you could add "--verify-builtin-command-table" as an unadvertised
option to "git" wrapper, and make t/t0000-basic.sh call it to minimize the
downside risk.  But without such an active measure to prevent mistakes, we
would be relying on somebody getting caught on a ticking bomb and
reporting it, which is not a good tradeoff between risk and reward.

  reply	other threads:[~2011-02-15 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 13:26 [PATCH] git.c: reorder builtin command list Nguyễn Thái Ngọc Duy
2011-02-14 19:20 ` Junio C Hamano
2011-02-15  3:09   ` [PATCH 1/2] " Nguyễn Thái Ngọc Duy
2011-02-15  3:09     ` [PATCH 2/2] git.c: binary-search builtin commands Nguyễn Thái Ngọc Duy
2011-02-15 20:12       ` Junio C Hamano [this message]
2011-02-16  3:46         ` Nguyen Thai Ngoc Duy

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=7v4o85njjz.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@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).