Re: [PATCH 7/7] builtin-merge: avoid non-strategy git-merge commands in error message
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 26, 2008, 15:08 UTC
- Message-ID
- <alpine.DEB.1.00.0807261701520.26810@eeepc-johanness>
- In-Reply-To
- <65a569c389352c5d0500b8c44c28e5572352e6ba.1217037178.git.vmiklos@frugalware.org>
Hi,
On Sat, 26 Jul 2008, Miklos Vajna wrote:
> + memset(¬_strategies, 0, sizeof(struct cmdnames));
> + for (i = 0; i < main_cmds.cnt; i++) {Looking through all the discovered git commands? Cute... But does that not exclude the commands that are in PATH, starting with git-merge-, even if they are custom strategies?
Show 6 quoted lines
> + int j, found = 0; > + for (j = 0; j < ARRAY_SIZE(all_strategy); j++) > + if (!strcmp(main_cmds.names[i]->name, all_strategy[j].name)) > + found = 1; > + if (!found) > + add_cmdname(¬_strategies, main_cmds.names[i]->name, strlen(main_cmds.names[i]->name));
Better have a local variable "name" instead of writing out "main_cmds.names[i]->name" all the time...
Oh, and you assume that the names are NUL-terminated (which I assume is not the case in general, as the len member is the only thing that makes struct cmdnames different from struct string_list.
Ciao, Dscho