]> git.ipfire.org Git - thirdparty/git.git/commitdiff
remote: add camel-cased *.tagOpt key, like clone
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 25 Feb 2021 01:21:16 +0000 (02:21 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Feb 2021 03:02:58 +0000 (19:02 -0800)
Change "git remote add" so that it adds a *.tagOpt key, and not the
lower-cased *.tagopt on "git remote add --no-tags", just as "git clone
--no-tags" would do.

This doesn't matter for anything that reads the config. It's just
prettier if we write config keys in their documented camelCase form to
user-readable config files.

When I added support for "clone -no-tags" in 0dab2468ee5 (clone: add a
--no-tags option to clone without tags, 2017-04-26) I made it use
the *.tagOpt form, but the older "git remote add" added in
111fb858654 (remote add: add a --[no-]tags option, 2010-04-20) has
been using *.tagopt all this time.

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. Let's add the test for "git clone" too for good
measure, not just to the "git remote" codepath we're fixing.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/remote.c
t/t5505-remote.sh
t/t5612-clone-refspec.sh

index d11a5589e49dcc9ea06663c422154855f9ad529b..f286ae9753800658d32d7bd609e5584e8505b745 100644 (file)
@@ -221,7 +221,7 @@ static int add(int argc, const char **argv)
 
        if (fetch_tags != TAGS_DEFAULT) {
                strbuf_reset(&buf);
-               strbuf_addf(&buf, "remote.%s.tagopt", name);
+               strbuf_addf(&buf, "remote.%s.tagOpt", name);
                git_config_set(buf.buf,
                               fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
        }
index ecadf02d64b115bc3706da27a7d544da4110911d..ffd821c00e3dd933da11a8742d215b627a4c20e7 100755 (executable)
@@ -591,6 +591,7 @@ test_expect_success 'add --no-tags' '
                cd add-no-tags &&
                git init &&
                git remote add -f --no-tags origin ../one &&
+               grep tagOpt .git/config &&
                git tag -l some-tag >../test/output &&
                git tag -l foobar-tag >../test/output &&
                git config remote.origin.tagopt >>../test/output
index e3b436d8ae791c587e92ac8d665b189ed1f82220..e1839238de7c75750faad57a2457edfc0108fd0c 100755 (executable)
@@ -94,6 +94,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
        ) &&