git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Gummerer <t.gummerer@gmail.com>
Cc: bturner@atlassian.com, gitster@pobox.com, pedrorijo91@gmail.com,
	git@vger.kernel.org
Subject: Re: [PATCH 3/4] ls-remote: use parse-options api
Date: Sun, 17 Jan 2016 09:44:09 -0500	[thread overview]
Message-ID: <20160117144409.GA15519@sigill.intra.peff.net> (raw)
In-Reply-To: <1453028643-13978-4-git-send-email-t.gummerer@gmail.com>

On Sun, Jan 17, 2016 at 12:04:01PM +0100, Thomas Gummerer wrote:

> Currently ls-remote uses a hand rolled parser for the its command line
> arguments.  Use the parse-options api instead of the hand rolled parser
> to simplify the code and make it easier to add new arguments.  In
> addition this improves the help message.

Sounds like a good idea.

> +	int tags = 0, heads = 0, refs = 0;
> [...]
> +		OPT_SET_INT('t', "tags", &tags, N_("limit to tags"), REF_TAGS),
> +		OPT_SET_INT('h', "heads", &heads, N_("limit to heads"), REF_HEADS),
> +		OPT_SET_INT(0, "refs", &refs, N_("no magic fake tag refs"), REF_NORMAL),
> [...]
> +	flags = tags | heads | refs;

Is there any reason these can't be:

  OPT_BIT('t', "tags", &flags, N_("limit to tags"), REF_TAGS),
  OPT_BIT('h', "heads", &flags, N_("limit to heads"), REF_HEADS),
  OPT_BIT(0, "refs", &flags, N_("no magic fake tag refs"), REF_NORMAL),

to make their interaction more obvious? I wondered if there was
anything tricky going on (like some of the bits for each option
overlapping), but I didn't see anything.

> +		OPT_SET_INT(0, "refs", &refs, N_("no magic fake tag refs"), REF_NORMAL),

I imagine you took the help string from the comment in check_ref. We can
probably come up with something more descriptive for the user-facing
string. :) How about "do not show peeled tags"?

> +		OPT_STRING(0, "upload-pack", &uploadpack, N_("exec"),
> +			   N_("path of git-upload-pack on the remote host")),
> +		OPT_STRING(0, "exec", &uploadpack, N_("exec"),
> +			   N_("path of git-upload-pack on the remote host")),

Since these are redundant with each other, should we declare one
"hidden" to not appear in "-h" output?

> +		OPT_SET_INT(0, "get-url", &get_url,
> +			    N_("take url.<base>.insteadOf into account"), 1),

Should this one be OPT_BOOL? I think "--no-get-url" works either way (it
resets the variable to 0), but OPT_BOOL communicates the intent more
clearly, I think.

> +		OPT_SET_INT(0, "exit-code", &status,
> +			    N_("exit with exit code 2 if no matching refs are found"), 2),

This one can't be OPT_BOOL, obviously. What happens with
"--no-exit-code"? We'll set it back to "0", which I think is the right
thing to do. Good.

The rest of the patch looked good to me.

-Peff

  reply	other threads:[~2016-01-17 14:44 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17 11:03 [PATCH 0/4] ls-remote: introduce symref argument Thomas Gummerer
2016-01-17 11:03 ` [PATCH 1/4] ls-remote: document --quiet option Thomas Gummerer
2016-01-17 14:47   ` Jeff King
2016-01-17 17:13     ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 2/4] ls-remote: fix synopsis Thomas Gummerer
2016-01-17 11:04 ` [PATCH 3/4] ls-remote: use parse-options api Thomas Gummerer
2016-01-17 14:44   ` Jeff King [this message]
2016-01-17 17:27     ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 4/4] builtin/ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-17 11:16   ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 4/4] ls-remote: " Thomas Gummerer
2016-01-17 15:15   ` Jeff King
2016-01-17 17:38     ` Thomas Gummerer
2016-01-17 22:14     ` Junio C Hamano
2016-01-17 11:14 ` [PATCH 0/4] ls-remote: introduce symref argument Thomas Gummerer
2016-01-17 15:16 ` Jeff King
2016-01-17 17:39   ` Thomas Gummerer
2016-01-17 22:15   ` Junio C Hamano
2016-01-18 16:57 ` [PATCH v2 0/5] ls-remote: introduce symrefs argument Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 1/5] ls-remote: document --quiet option Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 2/5] ls-remote: document --refs option Thomas Gummerer
2016-01-18 19:31     ` Jeff King
2016-01-18 20:01       ` Junio C Hamano
2016-01-18 21:39         ` Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 3/5] ls-remote: fix synopsis Thomas Gummerer
2016-01-18 16:57   ` [PATCH v2 4/5] ls-remote: use parse-options api Thomas Gummerer
2016-01-18 19:33     ` Jeff King
2016-01-18 16:57   ` [PATCH v2 5/5] ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-18 19:52     ` Jeff King
2016-01-18 19:53       ` Jeff King
2016-01-18 22:09         ` Thomas Gummerer
2016-01-18 22:09       ` Thomas Gummerer
2016-01-18 22:20         ` Jeff King
2016-01-18 22:35           ` Thomas Gummerer
2016-01-18 20:09     ` Junio C Hamano
2016-01-18 21:48       ` Thomas Gummerer
2016-01-18 19:53   ` [PATCH v2 0/5] ls-remote: introduce symrefs argument Jeff King
2016-01-18 23:20   ` [PATCH v3 0/5] ls-remote: introduce symref argument Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 1/5] ls-remote: document --quiet option Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 2/5] ls-remote: document --refs option Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 3/5] ls-remote: fix synopsis Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 4/5] ls-remote: use parse-options api Thomas Gummerer
2016-01-18 23:20     ` [PATCH v3 5/5] ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-19 18:14     ` [PATCH v3 0/5] ls-remote: introduce symref argument Junio C Hamano

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=20160117144409.GA15519@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bturner@atlassian.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pedrorijo91@gmail.com \
    --cc=t.gummerer@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.
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).