git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Johannes Schindelin <johannes.schindelin@gmail.com>,
	Jens Lehmann <Jens.Lehmann@web.de>, Jeff King <peff@peff.net>
Subject: Re: [PATCHv5 1/3] submodule: Reimplement `module_list` shell function in C
Date: Thu, 3 Sep 2015 12:18:51 -0700	[thread overview]
Message-ID: <CAGZ79kb5_VJwJoBpvUdVMC43qvJThKa1utQFO68HjM1sciZ6-w@mail.gmail.com> (raw)
In-Reply-To: <xmqqio7rjppv.fsf@gitster.mtv.corp.google.com>

On Thu, Sep 3, 2015 at 11:57 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> It is customary to use X_alloc, X_nr for an array X_something that
> is managed by ALLOC_GROW(), I think.  I'd also suggest wrapping
> these in a struct and passing it between module_list_compute() and
> its callers.

I did not take the suggestion as a strong suggestion at the time, but the
looking at resulting squash proposal it looks way better.

> I may have said this already, but unlike tree entries, the index
> entries will never be a directory.  S_ISDIR() check here is
> meaningless [*1*].

Right. I was too focused on the other bug, of checking S_ISGITLINK after
the pathspec matching, that I overlooked the ISDIR again. :(

>> +int cmd_submodule__helper(int argc, const char **argv, const char *prefix)
>> +{
>> +     int i;
>> +     if (argc < 2)
>> +             die(_("fatal: submodule--helper subcommand must be "
>> +                   "called with a subcommand"));
>> +
>> +     for (i = 0; i < ARRAY_SIZE(commands); i++)
>> +             if (!strcmp(argv[1], commands[i].cmd))
>> +                     return commands[i].fn(argc - 1, argv + 1, prefix);
>> +
>> +     die(_("fatal: '%s' is not a valid submodule--helper "
>> +           "subcommand"), argv[1]);
>> +}
>
> Nice and clean code structure.  I like it ;-).

It took a good while of discussion and reviews to arrive at
that structure eventually.

The squash proposal looks good to me.

  reply	other threads:[~2015-09-03 19:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 21:42 [PATCHv5 0/3] submodule--helper: Have some refactoring only patches first Stefan Beller
2015-09-02 21:42 ` [PATCHv5 1/3] submodule: Reimplement `module_list` shell function in C Stefan Beller
2015-09-03 18:57   ` Junio C Hamano
2015-09-03 19:18     ` Stefan Beller [this message]
2015-09-02 21:42 ` [PATCHv5 2/3] submodule: Reimplement `module_name` " Stefan Beller
2015-09-02 21:42 ` [PATCHv5 3/3] submodule: Reimplement `module_clone` " Stefan Beller
2015-09-03 22:07   ` Junio C Hamano
2015-09-08 18:31     ` Stefan Beller
2015-09-08 22:46       ` Junio C Hamano
2015-09-03 23:17   ` Eric Sunshine

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=CAGZ79kb5_VJwJoBpvUdVMC43qvJThKa1utQFO68HjM1sciZ6-w@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.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).