From: Junio C Hamano <gitster@pobox.com>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] parse-opt: migrate builtin-apply.
Date: Fri, 26 Dec 2008 23:29:42 -0800 [thread overview]
Message-ID: <7vtz8qgjo9.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1230351727-20116-1-git-send-email-vmiklos@frugalware.org> (Miklos Vajna's message of "Sat, 27 Dec 2008 05:22:07 +0100")
Miklos Vajna <vmiklos@frugalware.org> writes:
> The only notable user-visible/incompatible change is that the
> --build-fake-ancestor option now conforms to gitcli(7).
>
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>
> I know that we do care about incompatible changes a lot, though I think
> this is the right direction and probably --build-fake-ancestor is not a
> heavily used switch, so I hope that part is OK.
An acceptable justification for such a plumbing change is if (1) the old
syntax is still supported the same way as the original implementation,
*and* if (2) the new syntax is something that could not possibly have been
a valid input to the original implementation with a different meaning.
I think the condition (1) holds but (2) does not hold for your patch; even
though I think the latter breakage is excusable in this particular case,
it is not for the reason you cited.
That is,
(1) The parseopt parser allows both of these forms:
$ git apply --build-fake-ancestor file <input
$ git apply --build-fake-ancestor=file <input
The former has been how existing scripts that use the plumbing have
been feeding the file, and it is still supported.
(2) A script that used "git apply" and relied on the behaviour of
the original implementation could have fed a patch from a file
whose name is "--build-fake-ancestor=some-string", with this command
line:
$ git apply --build-fake-ancestor=file
Now such a script would break with the new parser.
The reason you are excused to break such an insane script is definitely
not because --build-fake-ancestor is a rarely used option. The whole
defence depends on the fact that --build-fake-ancestor=something is a very
unlikely name for any sane script to be using for its temporary file. It
could still be an end user input, but at that point you could simply doubt
the sanity of the end user and dismiss the issue away.
I am not fundamentally opposed to using parseopt in git-apply, and I think
the change to add a new and saner meaning to "--build-fake-ancestor=file"
on the command line is a good thing in the longer term. But your
justification for such a change should be given in such a way to show
clearly that you have thought things through. It has to be much better
than "it is not a heavily used switch anyway".
The saddest part of the story that pisses me off about this patch is that
you did not seem to have even run the test suite before sending it. t4105
and t4252 fail for me, at least.
I did not look at the patch very closely, but do you really need that many
option callbacks? My gut feeling is that many of them should be just
setting a boolean flag, and you can postprocess to get the correct "apply"
behaviour.
For example, you start with "apply" set to true, and let parseopt set
"diffstat" upon seeing "--stat", and set "cmdline_apply" upon seeing
"--apply". After parseopt returns, you determine the final value of
"apply" by using "diffstat" (and friends that would normally drop "apply")
and "cmdline_apply" (which would override such droppages). That way I
think you can lose many callback functions whose sole purpose is to drop
"apply" option, no?
next prev parent reply other threads:[~2008-12-27 7:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-27 4:22 [PATCH] parse-opt: migrate builtin-apply Miklos Vajna
2008-12-27 7:29 ` Junio C Hamano [this message]
2008-12-27 14:05 ` Miklos Vajna
2008-12-27 14:22 ` [PATCH v2] " Miklos Vajna
2008-12-27 21:47 ` Junio C Hamano
2009-01-05 19:12 ` Pierre Habouzit
2009-01-05 20:06 ` Miklos Vajna
2008-12-27 21:53 ` René Scharfe
2008-12-27 23:03 ` [PATCH] " Miklos Vajna
2008-12-28 0:05 ` Jacob Helwig
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=7vtz8qgjo9.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.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).