From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH] gc: use parse_options Date: Thu, 01 Nov 2007 17:49:25 -0700 Message-ID: <7vhck579pm.fsf@gitster.siamese.dyndns.org> References: <20071102002856.GB3282@crux.yyz.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org, gitster@pobox.com To: James Bowes X-From: git-owner@vger.kernel.org Fri Nov 02 01:49:52 2007 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 1InkjN-0005gu-3C for gcvg-git-2@gmane.org; Fri, 02 Nov 2007 01:49:49 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754663AbXKBAte (ORCPT ); Thu, 1 Nov 2007 20:49:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754526AbXKBAte (ORCPT ); Thu, 1 Nov 2007 20:49:34 -0400 Received: from sceptre.pobox.com ([207.106.133.20]:44168 "EHLO sceptre.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754482AbXKBAte (ORCPT ); Thu, 1 Nov 2007 20:49:34 -0400 Received: from sceptre (localhost.localdomain [127.0.0.1]) by sceptre.pobox.com (Postfix) with ESMTP id C72DE2EF; Thu, 1 Nov 2007 20:49:52 -0400 (EDT) Received: from pobox.com (ip68-225-240-77.oc.oc.cox.net [68.225.240.77]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by sceptre.sasl.smtp.pobox.com (Postfix) with ESMTP id 495179035B; Thu, 1 Nov 2007 20:49:49 -0400 (EDT) In-Reply-To: <20071102002856.GB3282@crux.yyz.redhat.com> (James Bowes's message of "Thu, 1 Nov 2007 20:28:57 -0400") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: James Bowes writes: > + struct option builtin_gc_options[] = { > + OPT_BOOLEAN(0, "prune", &prune, "prune unused objects"), I would write "unreferenced loose" instead of "unused" here... > + OPT_BOOLEAN(0, "aggressive", &aggressive, "be more thorough (increased runtime)"), > + OPT_BOOLEAN(0, "auto", &auto_gc, "enable auto-gc mode"), > + OPT_END() > + }; > + > git_config(gc_config); > > if (pack_refs < 0) > pack_refs = !is_bare_repository(); > > + parse_options(argc, argv, builtin_gc_options, builtin_gc_usage, 0); > + > + if (aggressive) { > + append_option(argv_repack, "-f", MAX_ADD); > + if (aggressive_window > 0) { > + sprintf(buf, "--window=%d", aggressive_window); > + append_option(argv_repack, buf, MAX_ADD); > } > } > - if (i != argc) > - usage(builtin_gc_usage); Now, what makes the command report error when the user says: $ git gc unwanted parameter Other than that, this is a good thing to have, I think.