From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Schindelin Subject: Re: [PATCH 7/7] builtin-merge: avoid non-strategy git-merge commands in error message Date: Sat, 26 Jul 2008 17:08:11 +0200 (CEST) Message-ID: References: <1217073292-27945-1-git-send-email-vmiklos@frugalware.org> <4f2b03391e3f85cf2224f97a2a7765d08707bd73.1217037178.git.vmiklos@frugalware.org> <68749731fe8de8b2a9ffc53963291aeab9256b82.1217037178.git.vmiklos@frugalware.org> <99c90877657be0ed439a9918f500d6ad132550a2.1217037178.git.vmiklos@frugalware.org> <13f39dd6752a34beeb6ecccb51dbc7546ef87182.1217037178.git.vmiklos@frugalware.org> <65a569c389352c5d0500b8c44c28e5572352e6ba.1217037178.git.vmiklos@frugalware.org> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: git@vger.kernel.org To: Miklos Vajna X-From: git-owner@vger.kernel.org Sat Jul 26 17:08:15 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1KMlNW-0002hi-EM for gcvg-git-2@gmane.org; Sat, 26 Jul 2008 17:08:14 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752316AbYGZPHK (ORCPT ); Sat, 26 Jul 2008 11:07:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752445AbYGZPHK (ORCPT ); Sat, 26 Jul 2008 11:07:10 -0400 Received: from mail.gmx.net ([213.165.64.20]:53735 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752244AbYGZPHJ (ORCPT ); Sat, 26 Jul 2008 11:07:09 -0400 Received: (qmail invoked by alias); 26 Jul 2008 15:07:07 -0000 Received: from 88-107-142-10.dynamic.dsl.as9105.com (EHLO eeepc-johanness.st-andrews.ac.uk) [88.107.142.10] by mail.gmx.net (mp013) with SMTP; 26 Jul 2008 17:07:07 +0200 X-Authenticated: #1490710 X-Provags-ID: V01U2FsdGVkX19jdwgPdopjx84ugrGCqDPEAIh25tFy4UjXLQVuCE x3KeGhPjWUHEtc X-X-Sender: user@eeepc-johanness In-Reply-To: <65a569c389352c5d0500b8c44c28e5572352e6ba.1217037178.git.vmiklos@frugalware.org> User-Agent: Alpine 1.00 (DEB 882 2007-12-20) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.5600000000000001 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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? > + 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