git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Pierre Habouzit <madcoder@debian.org>
Cc: Miklos Vajna <vmiklos@frugalware.org>, git@vger.kernel.org
Subject: Re: [PATCH] parse-opt: migrate builtin-checkout-index.
Date: Sun, 19 Oct 2008 13:59:05 -0700	[thread overview]
Message-ID: <7v4p387146.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20081019201934.GO16610@artemis.corp> (Pierre Habouzit's message of "Sun, 19 Oct 2008 22:19:34 +0200")

Pierre Habouzit <madcoder@debian.org> writes:

> On Sun, Oct 19, 2008 at 08:11:31PM +0000, Junio C Hamano wrote:
>> Miklos Vajna <vmiklos@frugalware.org> writes:
>
>> >> Right, I fixed this in option_parse_z(). --no-z should set
>> >> line_termination to \n instead of 1.
>> >
>> > Originally in option_parse_z() I had
>> >
>> >         line_termination = unset;
>> >
>> > which is in fact right, because (as Pierre pointed out) unset for short
>> > options are always false, but I changed it to
>> >
>> >         line_termination = 0;
>> >
>> > to make it more readable.
>> 
>> I think Pierre's comment is short-sighted.  Think of what would happen
>> when somebody adds "--nul" as a longer equivalent to "-z", since it is
>> extremely easy to do things like that with the use of parse-opt API?
>
> Err I was only pointing out that --no-z would no nothing, I actually
> didn't really read the argument :)  I didn't say having --null was a bad
> idea,...

It is a good practice to anticipate potential future breakages, assess the
cost to avoid them, avoid the ones that can be avoided with minimum cost
(and document the others you know will be broken).  That's the key to
produce maintainable piece of code.  The change necessary to Miklos's
original code to do this is quite simple (i.e. flip between '\0' and
'\n'), and I didn't see any room for argument like "short option won't let
you say --no-z".  That's where my comment about "short-sighted"-ness comes
from.

  reply	other threads:[~2008-10-19 21:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 22:55 [PATCH] parse-opt: migrate builtin-checkout-index Miklos Vajna
2008-10-16  8:23 ` Pierre Habouzit
2008-10-16 13:28   ` [PATCH v2] " Miklos Vajna
2008-10-17 23:58     ` Junio C Hamano
2008-10-18  1:17       ` [PATCH] " Miklos Vajna
2008-10-19 18:30         ` Miklos Vajna
2008-10-19 18:31           ` Miklos Vajna
2008-10-19 20:11           ` Junio C Hamano
2008-10-19 20:19             ` Pierre Habouzit
2008-10-19 20:59               ` Junio C Hamano [this message]
2008-10-19 19:29         ` Raphael Zimmerer
2008-10-19 19:34           ` Pierre Habouzit
2008-10-19 21:45         ` Junio C Hamano
2008-10-18 15:54       ` [PATCH v2] " Pierre Habouzit

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=7v4p387146.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=madcoder@debian.org \
    --cc=vmiklos@frugalware.org \
    /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).