From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Schindelin Subject: Re: [PATCH] make commit --interactive lock index Date: Thu, 29 May 2008 14:55:11 +0100 (BST) Message-ID: References: <483EABD8.3050600@gnu.org> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Git mailing list To: Paolo Bonzini X-From: git-owner@vger.kernel.org Thu May 29 16:01:54 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 1K1idT-0007eH-Ld for gcvg-git-2@gmane.org; Thu, 29 May 2008 15:57:44 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755739AbYE2N4X (ORCPT ); Thu, 29 May 2008 09:56:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756922AbYE2N4W (ORCPT ); Thu, 29 May 2008 09:56:22 -0400 Received: from mail.gmx.net ([213.165.64.20]:50311 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752886AbYE2N4U (ORCPT ); Thu, 29 May 2008 09:56:20 -0400 Received: (qmail invoked by alias); 29 May 2008 13:56:19 -0000 Received: from wbgn128.biozentrum.uni-wuerzburg.de (EHLO none.local) [132.187.25.128] by mail.gmx.net (mp037) with SMTP; 29 May 2008 15:56:19 +0200 X-Authenticated: #1490710 X-Provags-ID: V01U2FsdGVkX1984Kt3/gt8KB7R+23DG0TjQsiihrsUqA5YKdAvXF JwtFrT4GjKZy17 X-X-Sender: gene099@racer.site.net In-Reply-To: <483EABD8.3050600@gnu.org> User-Agent: Alpine 1.00 (DEB 882 2007-12-20) X-Y-GMX-Trusted: 0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Hi, On Thu, 29 May 2008, Paolo Bonzini wrote: > Johannes Schindelin wrote: > > > On Thu, 29 May 2008, Paolo Bonzini wrote: > > > > > @@ -233,6 +228,8 @@ static char *prepare_index(int argc, const char > > > **argv, const char *prefix) > > > if (*argv) > > > pathspec = get_pathspec(prefix, argv); > > > > > > + assert (!(interactive && pathspec && *pathspec)); > > > > As pathspec is specified indirectly by the user, I think an assert() > > here is actively wrong. > > But the program may still guarantee a condition by checking it > elsewhere. I don't need to teach you about that, do I? In particular, > the assert checks that this: > > if (interactive && argc > 0) > die("Paths with --interactive does not make sense."); > > ... is equivalent to !pathspec || !*pathspec. Okay, I have to spell it out: I think that the assert() here is not helpful at all, and that you should rather do the "if () die()" thingie. Ciao, Dscho