From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [BUG] git config does not reuse section name Date: Mon, 07 Dec 2009 19:27:05 -0800 Message-ID: <7vy6lep2ly.fsf@alter.siamese.dyndns.org> References: <4B1D360B.4070203@ubicom.com> <7vy6le35zv.fsf@alter.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Yakup Akbay , git@vger.kernel.org To: Johannes Schindelin X-From: git-owner@vger.kernel.org Tue Dec 08 04:27:30 2009 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1NHqjZ-0002EG-Ns for gcvg-git-2@lo.gmane.org; Tue, 08 Dec 2009 04:27:30 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935085AbZLHD1J (ORCPT ); Mon, 7 Dec 2009 22:27:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934778AbZLHD1J (ORCPT ); Mon, 7 Dec 2009 22:27:09 -0500 Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:65311 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934690AbZLHD1I (ORCPT ); Mon, 7 Dec 2009 22:27:08 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 075DCA5DA7; Mon, 7 Dec 2009 22:27:15 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=to:cc:subject :references:from:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=5v7NbiuKJNPOWy92sX+QxSC4LQE=; b=tSM8zr MdaR3PsPekKp2I2ocyPI0LXIJ3pcTG2ROcP5L8coJAEejBhNZYw0QMz3RFgy93/O YT1lduSHcrVDWbTlQo9qvAdVDASRoNn1RrNVKBVYIg74aMGAQWDd/In3Lh2ovgRz AYaDFBaNgPU9D3IpQLawhY1uFuW2orAcIkwK4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=to:cc:subject :references:from:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=b3giGtYcFo88eTEa93SyekK7PCzWvmqB gqfReYJvm2FoISb8B+hRUBqvib8d0j+a6ydIMHBrnFVCmg6qtasEVwL8YCO4eHbi c5I/7zrJEP+xMlLXrTII5vaL/u8msI9EWlxh2jtyzAqJwtbCIEa7E030tsYQyyf/ l/5gKfDkIAQ= Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id C9B59A5DA6; Mon, 7 Dec 2009 22:27:11 -0500 (EST) Received: from pobox.com (unknown [68.225.240.211]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 92D32A5DA5; Mon, 7 Dec 2009 22:27:07 -0500 (EST) In-Reply-To: (Johannes Schindelin's message of "Tue\, 8 Dec 2009 03\:01\:21 +0100 \(CET\)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-Pobox-Relay-ID: 92B214AC-E3A9-11DE-92B6-EF34BBB5EC2E-77302942!a-pb-sasl-sd.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Johannes Schindelin writes: > IIRC, due to technical limitations, the config machinery only recognizes > sections if there is at least _one_ entry in them. This is because > git_config() is used to determine (from the current file position) where > the section begins. Ah, the reading side should be able to get by with that parsing logic, as an empty section is totally ignorable anyway. And the parser for the writing side reuses that logic. Asking for removal code to notice the empty section and remove it needs a bit of restructuring of the parsing logic as currently it doesn't even see an empty section. Thanks---the explanation makes sense (I am not saying "it justifies it"; I only mean "it explains why the code behaves like that very well"). I think we have kept the original parsing structure since repo-config added the write support, and "fixing" the issue is not that urgent, but it would be nice to get it fixed. Perhaps somebody can find some time over the upcoming holidays ;-)