From: Brandon Richardson <brandon1024.br@gmail.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>, szeder.dev@gmail.com
Subject: Re: [PATCH] commit-tree: utilize parse-options api
Date: Wed, 27 Feb 2019 11:24:46 -0400 [thread overview]
Message-ID: <CAETBDP5pfuNP4JQDaxN613sthRziJT7CZd=tjhWLpMSME9JjOQ@mail.gmail.com> (raw)
In-Reply-To: <CACsJy8Bgz6FiTqnq8pnebuyOr55Bqh67iRhr6J+WvzgxPSBLhw@mail.gmail.com>
Thank you all for the helpful comments :-)
On Wed, 27 Feb 2019 at 07:08, Duy Nguyen <pclouds@gmail.com> wrote:
> > It was discovered that the --no-gpg-sign option was documented
> > but not implemented in 55ca3f99, and the existing implementation
>
> Most people refer to a commit with this format
>
> 55ca3f99ae (commit-tree: add and document --no-gpg-sign - 2013-12-13)
>
> It gives the reader some context without actually looking at the
> commit in question. And in the event that 55ca3f99 is ambiguous, it's
> easier to find the correct one.
I didn't know this, thank you for the tip. I'll start doing this from now on.
I will also reread through the SubmittingPatches doc.
> > +static int parse_parent_arg_callback(const struct option *opt,
> > + const char *arg, int unset)
> > +{
> > + struct object_id oid;
> > + struct commit_list **parents = opt->value;
> > +
> > + BUG_ON_OPT_NEG(unset);
> > +
> > + if (!arg)
> > + return 1;
>
> This "return 1;" surprises me because I think we often just return 0
> or -1. I know !arg cannot happen here, so maybe just drop it. Or if
> you want t play absolutely safe, maybe add a new macro like
>
> BUG_ON_NO_ARG(arg);
>
> which conveys the intention much better.
I like the BUG_ON_NO_ARG approach. I will go that route.
> > +static int parse_file_arg_callback(const struct option *opt,
> > + const char *arg, int unset)
>
> I would suggest you do the same for -F, i.e. collect a string list of
> paths then do the heavy lifting afterwards _IF_ we don't support
> mixing -m and -F. If we do, then we have to handle both in callbacks
> to make sure we compose the message correctly.
I opted to use callbacks here to allow mixing -m and -F so that messages
are composed correctly, as you mentioned. I did so in an attempt to match
the existing functionality of commit-tree.
>
> > + OPT_END()
> > + };
>
> I think you're using spaces here to indent instead of TABs.
Good eye on the whitespace issue. I'm still dialling in my environment,
so please forgive me.
I will address all comments in a v2. Thanks again.
Brandon
next prev parent reply other threads:[~2019-02-27 15:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 20:09 [PATCH] commit-tree: utilize parse-options api Brandon
2019-02-26 22:38 ` Andrei Rybak
2019-02-26 23:42 ` Brandon Richardson
2019-02-27 11:13 ` Duy Nguyen
2019-02-27 11:07 ` Duy Nguyen
2019-02-27 11:37 ` SZEDER Gábor
2019-02-27 11:49 ` Duy Nguyen
2019-02-27 12:36 ` SZEDER Gábor
2019-02-28 7:21 ` Duy Nguyen
2019-02-27 15:24 ` Brandon Richardson [this message]
2019-02-28 7:26 ` Duy Nguyen
2019-02-27 16:35 ` Jeff King
2019-02-28 2:46 ` Brandon Richardson
2019-02-28 20:56 ` Jeff King
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='CAETBDP5pfuNP4JQDaxN613sthRziJT7CZd=tjhWLpMSME9JjOQ@mail.gmail.com' \
--to=brandon1024.br@gmail.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=szeder.dev@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).