git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Bert Wesarg <bert.wesarg@googlemail.com>
Subject: Re: [PATCH 1/2] remote: add camel-cased *.tagOpt key, like clone
Date: Thu, 25 Feb 2021 20:47:35 +0100	[thread overview]
Message-ID: <87wnuw6iaw.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqwnuwx2ea.fsf@gitster.g>


On Thu, Feb 25 2021, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>
>> It's easy enough to add a test for this, so let's do that. We can't
>> use "git config -l" there, because it'll normalize the keys to their
>> lower-cased form.
>
> I wondered if we want "git config -l --preserve-case" or something
> like that, but an extra grep for "tagOpt" would be sufficient in a
> simple test like these that are unlikely to have unrelated tagOpt
> defined in the file.  More importantly, I am starting to doubt if
> this should even be tested.
>
> If there were existing "section.varname" variable definition and we
> ask
>
> 	git_config_set("section.varName", "newvalue");
>
> we may end up with "[section] varname = newvalue", and that is
> perfectly OK, I would think, because the first and the last
> component of the configuration variable names are defined to be case
> insensitive, and here may be "[Section] varname = oldvalue" in the
> configuration file before we try to set it, and the implementation
> is free to replace "oldvalue" with "newvalue", instead of first
> removing "[Section] varname = oldvalue" and then adding a new
> "[section] varName = newvalue" (after all, there may be variables
> other than "varname" in the section, and the existing "[Section]"
> header may need to be kept for the remaining variables while we futz
> with the varname or varName).
>
> Which means that while we do want to spell the names in our source
> code correctly (i.e. "tagOpt", not "tagopt") when we tell which
> variable we want to get modified to the git_config_set() function,
> we should not care how exactly git_config_set() chooses to spell the
> variable in the resulting configuration file, no?
>
> So, ...

Yes, in general, but...

>> diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh
>> index 6a6af7449ca..3126cfd7e9d 100755
>> --- a/t/t5612-clone-refspec.sh
>> +++ b/t/t5612-clone-refspec.sh
>> @@ -97,6 +97,7 @@ test_expect_success 'by default no tags will be kept updated' '
>>  test_expect_success 'clone with --no-tags' '
>>  	(
>>  		cd dir_all_no_tags &&
>> +		grep tagOpt .git/config &&
>>  		git fetch &&
>>  		git for-each-ref refs/tags >../actual
>
> ...as long as "git config remote.origin.tagopt" yields what we
> expect, we should be OK, I would think.  Insisting that the variable
> name is kept by git_config_set() API may be expecting too much.
>
>>  	) &&

...the cases fixed in this series are not ones where we're possibly
changing an existing variable name, but where we're guaranteed to be
writing new values.

We are renaming a remote or otherwise moving variables around, if there
were existing values to contend with we'd have died earlier.

I'm not quite sure what to make of this feedback in general. That you'd
like the bugfix but we shouldn't bother with a regression test, or that
we shouldn't bother with the fix at all?

I admit this is getting to diminishing returns in testing, we're
unlikely to break this, and if we do it's not such a big deal.

But I don't agree that we should feel free to munge user config files
within the bound of valid config syntax when we edit these files for
users.

We already go out of our way to add values to existing sections, not add
new empty headings etc. (I believe the last major effort on that front
was from Johannes S. a while back).

likewise here, even though cmd.averylongvariablename is perfectly valid,
it's much more user friendly if we write/edit it as
cmd.AVeryLongVariableName.

  reply	other threads:[~2021-02-25 19:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  1:21 [PATCH 1/2] remote: add camel-cased *.tagOpt key, like clone Ævar Arnfjörð Bjarmason
2021-02-25  1:21 ` [PATCH 2/2] remote: write camel-cased *.pushRemote on rename Ævar Arnfjörð Bjarmason
2021-02-25  3:17   ` Junio C Hamano
2021-03-18 11:22   ` Bert Wesarg
2021-02-25  3:02 ` [PATCH 1/2] remote: add camel-cased *.tagOpt key, like clone Junio C Hamano
2021-02-25  3:16 ` Junio C Hamano
2021-02-25 19:47   ` Ævar Arnfjörð Bjarmason [this message]
2021-02-25 20:00     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnuw6iaw.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).