From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH/RFC 5/5] add tests for checking the behaviour of "unset.variable" Date: Thu, 02 Oct 2014 13:23:02 -0700 Message-ID: References: <1412256292-4286-1-git-send-email-tanayabh@gmail.com> <1412256292-4286-6-git-send-email-tanayabh@gmail.com> <542DB2FE.609@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Cc: git@vger.kernel.org, Matthieu Moy To: Tanay Abhra X-From: git-owner@vger.kernel.org Thu Oct 02 22:23:12 2014 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XZmu7-0001U6-Cd for gcvg-git-2@plane.gmane.org; Thu, 02 Oct 2014 22:23:11 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752055AbaJBUXG (ORCPT ); Thu, 2 Oct 2014 16:23:06 -0400 Received: from smtp.pobox.com ([208.72.237.35]:58914 "EHLO smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbaJBUXF (ORCPT ); Thu, 2 Oct 2014 16:23:05 -0400 Received: from smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id 3EBF040D21; Thu, 2 Oct 2014 16:23:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=leLwf4CI2SJ/5lX8JwdpZ0q9afo=; b=hhb+gx G6f6ye5f4uYfrvPtKZCkAyJWMzpOHVkhDIs5XdxUCP43ai5UfoxNMRWkrA2zaKxR A/RAiMZBnmronFQE/jOPn6hv8f4npTNTeCkkVIDNatSEk01lAF/HQkZODjPaYpGK 8neEnsdFuaUXUycACS4pinrtq0TYhqtZfa3sk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=NVli/eKpObdsagohHY4OyqMIoh/bBJ7a 5l8i/tmkiZlxcRi1cB26cLDNcNhELktCHU3TrjHHyq22j9sWqpAzhFqG9APRSjLL +QXR0OSFQZFY6+PtpzAEcrM6wh0wjiAytowiH69DVw0pDbX5eylSVlm18s/rMg4F CDzh0OulWUk= Received: from pb-smtp0.int.icgroup.com (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id 34C5C40D20; Thu, 2 Oct 2014 16:23:04 -0400 (EDT) Received: from pobox.com (unknown [72.14.226.9]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by pb-smtp0.pobox.com (Postfix) with ESMTPSA id 8F92240D1D; Thu, 2 Oct 2014 16:23:03 -0400 (EDT) In-Reply-To: <542DB2FE.609@gmail.com> (Tanay Abhra's message of "Fri, 03 Oct 2014 01:48:06 +0530") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Pobox-Relay-ID: E96D9E4A-4A71-11E4-B1FE-9E3FC4D60FE0-77302942!pb-smtp0.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Tanay Abhra writes: > On 10/3/2014 1:39 AM, Junio C Hamano wrote: >> Tanay Abhra writes: >> >>> +test_expect_success 'document how unset.variable will behave in shell scripts' ' >>> + rm -f .git/config && >>> + cat >expect <<-\EOF && >>> + EOF >>> + git config foo.bar boz1 && >>> + git config --add foo.bar boz2 && >>> + git config unset.variable foo.bar && >>> + git config --add foo.bar boz3 && >>> + test_must_fail git config --get-all foo.bar >actual && >> >> You make foo.bar a multi-valued one, then you unset it, so I would >> imagine that the value given after that, 'boz3', would be the only >> value foo.bar has. Why should --get-all fail? >> >> I am having a hard time imagining how this behaviour can make any >> sense. >> > > git config -add appends the value to a existing header, after these > two commands have executed the config file would look like, > ... I *know* how it is implemented before the changes of this series. And if the original implementation of "add" is left as-is, I can imagine how such a behaviour that is unintuitive to end-users can arise. I was and am having a hard time how this behaviour can make any sense from an end-user's point of view.