From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tanay Abhra Subject: Re: [PATCH/RFC 5/5] add tests for checking the behaviour of "unset.variable" Date: Fri, 03 Oct 2014 01:48:06 +0530 Message-ID: <542DB2FE.609@gmail.com> References: <1412256292-4286-1-git-send-email-tanayabh@gmail.com> <1412256292-4286-6-git-send-email-tanayabh@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: git@vger.kernel.org, Matthieu Moy To: Junio C Hamano X-From: git-owner@vger.kernel.org Thu Oct 02 22:18:16 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 1XZmpL-0007mM-Kp for gcvg-git-2@plane.gmane.org; Thu, 02 Oct 2014 22:18:15 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751917AbaJBUSL (ORCPT ); Thu, 2 Oct 2014 16:18:11 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:53963 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334AbaJBUSK (ORCPT ); Thu, 2 Oct 2014 16:18:10 -0400 Received: by mail-pa0-f41.google.com with SMTP id eu11so3458888pac.14 for ; Thu, 02 Oct 2014 13:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Yoxsri84Au1HszMzjXcVgwCk4B3BGa2KpqioIW2bhJY=; b=ZBoutYEYl6o3gdGbc1Sk4ickicGG2c41wobXAUAfjU00LepYsyyAeL+ctX//m0x/Sw 8ffDI6mf5Ht9/H2ELXEHXyqCD9IM7Grk8wxnERHkuOB4hXUkyXoGd2kZLyJGGvJigm1Q UAIpPVWsfhDW6ImrrUVoYjvRrJ20YO+zxREeSqFpAhK8ksLF1N+z0uNuP915hWLeXFod 9Q+vDQRclnrHU+wdKi/75K3+B8Fmkw08hZpZRP2AP9FaWCbB1JtMv8xNWAL/utcLtDeQ DcwnFKBWfaQKigK98v/IMIWedRs1/nxEHfk1Wyq3mKti5y3/rPP44GEKqVgTN+7WZsGp ucdA== X-Received: by 10.66.145.133 with SMTP id su5mr1590433pab.11.1412281089801; Thu, 02 Oct 2014 13:18:09 -0700 (PDT) Received: from [127.0.0.1] ([223.176.236.129]) by mx.google.com with ESMTPSA id nx6sm1319017pab.46.2014.10.02.13.18.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Oct 2014 13:18:09 -0700 (PDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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, git config foo.bar boz1 && git config --add foo.bar boz2 && [foo] bar = boz1 bar = boz2 After git config unset.variable foo.bar, [foo] bar = boz1 bar = boz2 [unset] variable = foo.bar Now the tricky part, git config --add foo.bar boz3 append to the existing header, [foo] bar = boz1 bar = boz2 bar = boz3 [unset] variable = foo.bar Since unset.variable unsets all previous set values in parsing order, git config --get-all foo.bar gives us nothing in result.