On Thu, Sep 3, 2015 at 11:57 AM, Junio C Hamano <[email protected]> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html