git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Christian Couder <christian.couder@gmail.com>,
	git@vger.kernel.org, Donald R Laster Jr <laster@dlaster.com>,
	Jacob Keller <jacob.keller@gmail.com>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH v3 1/7] git-compat-util: introduce skip_to_optional_arg()
Date: Mon, 11 Dec 2017 15:23:15 -0800	[thread overview]
Message-ID: <xmqqmv2o4zoc.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171210143914.GA19894@sigill.intra.peff.net> (Jeff King's message of "Sun, 10 Dec 2017 09:39:15 -0500")

Jeff King <peff@peff.net> writes:

>
>   +       else if (starts_with(arg, "-B") ||
>   +                skip_to_optional_arg(arg, "--break-rewrites", NULL)) {
> 	  if ((options->break_opt = diff_scoreopt_parse(arg)) == -1)
>
> So that's kind-of weird, because we are parsing "-B", etc, and then
> expecting it to be _reparsed_ by diff_scoreopt_parse. So the two
> callsites must always match.

Correct.  diff_scoreopt_parse() can be coaxed to fit better within
this if/else if/... cascade by making it take a pointer to .break_opt
field and have it return "did I handle the -B/break-rewrites?" etc.,
but otherwise, this shows that skip_to_optional_arg() has impedance
mismatch with its current API.  And the NULL thing serves as a reminder
that skip_to_optional_arg() is used _only_ as a prefix check and not
for parsing.



      parent reply	other threads:[~2017-12-11 23:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-09 20:40 [PATCH v3 1/7] git-compat-util: introduce skip_to_optional_arg() Christian Couder
2017-12-09 20:40 ` [PATCH v3 2/7] index-pack: use skip_to_optional_arg() Christian Couder
2017-12-09 20:40 ` [PATCH v3 3/7] diff: " Christian Couder
2017-12-09 20:40 ` [PATCH v3 4/7] diff: use skip_to_optional_arg_default() Christian Couder
2017-12-09 20:40 ` [PATCH v3 5/7] diff: use skip_to_optional_arg_default() in parsing --relative Christian Couder
2017-12-09 20:40 ` [PATCH v3 6/7] diff: add tests for --relative without optional prefix value Christian Couder
2017-12-09 20:40 ` [PATCH v3 7/7] t4045: reindent to make helpers readable Christian Couder
2017-12-10 14:31 ` [PATCH v3 1/7] git-compat-util: introduce skip_to_optional_arg() Jeff King
2017-12-10 14:39   ` Jeff King
2017-12-11  5:56     ` Christian Couder
2017-12-11 23:23     ` Junio C Hamano [this message]

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=xmqqmv2o4zoc.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.keller@gmail.com \
    --cc=laster@dlaster.com \
    --cc=peff@peff.net \
    /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).