{"thread":{"id":"62065","subject":"[PATCH] scalar: add --no-tags option","startedAt":"2024-09-05T14:13:38Z","lastAt":"2024-09-06T20:21:46Z","messageCount":7,"participants":["Derrick Stolee via GitGitGadget","Junio C Hamano","Johannes Schindelin","Derrick Stolee"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"502239","messageId":"pull.1780.git.1725545614416.gitgitgadget@gmail.com","threadId":"62065","inReplyTo":null,"subject":"[PATCH] scalar: add --no-tags option","fromName":"Derrick Stolee via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-09-05T14:13:34Z","receivedAt":"2024-09-05T14:13:38Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"From: Derrick Stolee <stolee@gmail.com>\n\nSome large repositories use tags to track a huge list of release\nversions. While this is choice is costly on the ref advertisement, it is\nfurther wasteful for clients who do not need those tags. Allow clients\nto optionally skip the tag advertisement.\n\nThis behavior is similar to that of 'git clone --no-tags' implemented in\n0dab2468ee5 (clone: add a --no-tags option to clone without tags,\n2017-04-26), including the modification of the remote.origin.tagOpt\nconfig value to include \"--no-tags\".\n\nOne thing that is opposite of the 'git clone' implementation is that\nthis allows '--tags' as an assumed option, which can be naturally negated\nwith '--no-tags'. The clone command does not accept '--tags' but allows\n\"--no-no-tags\" as the negation of its '--no-tags' option.\n\nWhile testing this option, combine the test with the previously untested\n'--no-src' option introduced in 4527db8ff8c (scalar: add --[no-]src\noption, 2023-08-28).\n\nSigned-off-by: Derrick Stolee <stolee@gmail.com>\n---\n    scalar: add --no-tags option\n    \n    The need for this was discovered due to the release behavior of an\n    internal monorepo. The use of Azure DevOps' limited refs feature does\n    not apply to tags, so the number of tags was causing some pain for\n    users.\n    \n    Thanks, -Stolee\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1780%2Fderrickstolee%2Fscalar-no-tags-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1780/derrickstolee/scalar-no-tags-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1780\n\n Documentation/scalar.txt |  6 ++++++\n scalar.c                 | 15 ++++++++++++---\n t/t9210-scalar.sh        | 18 ++++++++++++++++++\n 3 files changed, 36 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/scalar.txt b/Documentation/scalar.txt\nindex 361f51a6473..507ed2ae669 100644\n--- a/Documentation/scalar.txt\n+++ b/Documentation/scalar.txt\n@@ -86,6 +86,12 @@ cloning. If the HEAD at the remote did not point at any branch when\n \t`<entlistment>/src` directory. Use `--no-src` to place the cloned\n \trepository directly in the `<enlistment>` directory.\n \n+--[no-]tags::\n+\tBy default, `scalar clone` will fetch the tag objects advertised by\n+\tthe remote and future `git fetch` commands will do the same. Use\n+\t`--no-tags` to avoid fetching tags in `scalar clone` and to configure\n+\tthe repository to avoid fetching tags in the future.\n+\n --[no-]full-clone::\n \tA sparse-checkout is initialized by default. This behavior can be\n \tturned off via `--full-clone`.\ndiff --git a/scalar.c b/scalar.c\nindex 6166a8dd4c8..c6dd746b5b2 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -410,7 +410,7 @@ static int cmd_clone(int argc, const char **argv)\n {\n \tconst char *branch = NULL;\n \tint full_clone = 0, single_branch = 0, show_progress = isatty(2);\n-\tint src = 1;\n+\tint src = 1, tags = 1;\n \tstruct option clone_options[] = {\n \t\tOPT_STRING('b', \"branch\", &branch, N_(\"<branch>\"),\n \t\t\t   N_(\"branch to checkout after clone\")),\n@@ -421,11 +421,13 @@ static int cmd_clone(int argc, const char **argv)\n \t\t\t    \"be checked out\")),\n \t\tOPT_BOOL(0, \"src\", &src,\n \t\t\t N_(\"create repository within 'src' directory\")),\n+\t\tOPT_BOOL(0, \"tags\", &tags,\n+\t\t\t N_(\"specify if tags should be fetched during clone\")),\n \t\tOPT_END(),\n \t};\n \tconst char * const clone_usage[] = {\n \t\tN_(\"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\\n\"\n-\t\t   \"\\t[--[no-]src] <url> [<enlistment>]\"),\n+\t\t   \"\\t[--[no-]src] [--[no-]tags] <url> [<enlistment>]\"),\n \t\tNULL\n \t};\n \tconst char *url;\n@@ -504,6 +506,11 @@ static int cmd_clone(int argc, const char **argv)\n \t\tgoto cleanup;\n \t}\n \n+\tif (!tags && set_config(\"remote.origin.tagOpt=--no-tags\")) {\n+\t\tres = error(_(\"could not disable tags in '%s'\"), dir);\n+\t\tgoto cleanup;\n+\t}\n+\n \tif (!full_clone &&\n \t    (res = run_git(\"sparse-checkout\", \"init\", \"--cone\", NULL)))\n \t\tgoto cleanup;\n@@ -513,7 +520,9 @@ static int cmd_clone(int argc, const char **argv)\n \n \tif ((res = run_git(\"fetch\", \"--quiet\",\n \t\t\t\tshow_progress ? \"--progress\" : \"--no-progress\",\n-\t\t\t\t\"origin\", NULL))) {\n+\t\t\t\t\"origin\",\n+\t\t\t\t(!tags ? \"--no-tags\" : NULL),\n+\t\t\t\tNULL))) {\n \t\twarning(_(\"partial clone failed; attempting full clone\"));\n \n \t\tif (set_config(\"remote.origin.promisor\") ||\ndiff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh\nindex a41b4fcc085..e8613990e13 100755\n--- a/t/t9210-scalar.sh\n+++ b/t/t9210-scalar.sh\n@@ -169,6 +169,24 @@ test_expect_success 'scalar clone' '\n \t)\n '\n \n+test_expect_success 'scalar clone --no-... opts' '\n+\t# Note: redirect stderr always to avoid having a verbose test\n+\t# run result in a difference in the --[no-]progress option.\n+\tGIT_TRACE2_EVENT=\"$(pwd)/no-opt-trace\" scalar clone \\\n+\t\t--no-tags --no-src \\\n+\t\t\"file://$(pwd)\" no-opts --single-branch 2>/dev/null &&\n+\n+\ttest_subcommand git fetch --quiet --no-progress \\\n+\t\t\torigin --no-tags <no-opt-trace &&\n+\t(\n+\t\tcd no-opts &&\n+\n+\t\ttest_cmp_config --no-tags remote.origin.tagopt &&\n+\t\tgit for-each-ref --format=\"%(refname)\" refs/tags/ >tags &&\n+\t\ttest_line_count = 0 tags\n+\t)\n+'\n+\n test_expect_success 'scalar reconfigure' '\n \tgit init one/src &&\n \tscalar register one &&\n\nbase-commit: 2e7b89e038c0c888acf61f1b4ee5a43d4dd5e94c\n-- \ngitgitgadget\n"},{"id":"502255","messageId":"xmqq7cbq3wqx.fsf@gitster.g","threadId":"62065","inReplyTo":"pull.1780.git.1725545614416.gitgitgadget@gmail.com","subject":"Re: [PATCH] scalar: add --no-tags option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-09-05T16:12:38Z","receivedAt":"2024-09-05T16:12:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Derrick Stolee via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Derrick Stolee <stolee@gmail.com>\n>\n> Some large repositories use tags to track a huge list of release\n> versions. While this is choice is costly on the ref advertisement, it is\n> further wasteful for clients who do not need those tags. Allow clients\n> to optionally skip the tag advertisement.\n>\n> This behavior is similar to that of 'git clone --no-tags' implemented in\n> 0dab2468ee5 (clone: add a --no-tags option to clone without tags,\n> 2017-04-26), including the modification of the remote.origin.tagOpt\n> config value to include \"--no-tags\".\n>\n> One thing that is opposite of the 'git clone' implementation is that\n> this allows '--tags' as an assumed option, which can be naturally negated\n> with '--no-tags'. The clone command does not accept '--tags' but allows\n> \"--no-no-tags\" as the negation of its '--no-tags' option.\n\nYuck.  The loophole may be something we may want to close later,\nthough (and replaced with a proper \"--tags\" support).\n\n> While testing this option, combine the test with the previously untested\n> '--no-src' option introduced in 4527db8ff8c (scalar: add --[no-]src\n> option, 2023-08-28).\n>\n> Signed-off-by: Derrick Stolee <stolee@gmail.com>\n> ---\n\nMakes sense.\n\nThis is a tangent, but the \"--[no-]tags\" option in \"git fetch\" is\nmisdesigned; the default is to auto-follow tags that would annotate\nobjects that are being fetched, and \"--no-tags\" is a way to decline\nthe auto-following.  But \"--tags\" is to say that all tags must be\nfetched.  There is no obvious way to say \"I want the auto-following\nbehaviour\" (e.g., to override an earlier \"--no-tags\" or \"--tags\").\n"},{"id":"502277","messageId":"xmqqwmjq0xh5.fsf@gitster.g","threadId":"62065","inReplyTo":"pull.1780.git.1725545614416.gitgitgadget@gmail.com","subject":"Re: [PATCH] scalar: add --no-tags option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-09-05T18:25:10Z","receivedAt":"2024-09-05T18:25:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Derrick Stolee via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> Subject: Re: [PATCH] scalar: add --no-tags option\n\nMicronit.  Shouldn't we make it clear that this is about the clone\nsubcommand?  E.g.\n\n    Subject: scalar: add --no-tags option to \"scalar clone\"\n\nor something?\n"},{"id":"502308","messageId":"58ca5257-2e56-830c-c85f-79e4c9e80858@gmx.de","threadId":"62065","inReplyTo":"pull.1780.git.1725545614416.gitgitgadget@gmail.com","subject":"Re: [PATCH] scalar: add --no-tags option","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2024-09-06T07:23:49Z","receivedAt":"2024-09-06T07:23:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Stolee,\n\nthe patch makes sense to me. The commit message is delightfully thorough.\nI'll just offer minor suggestions below:\n\nOn Thu, 5 Sep 2024, Derrick Stolee via GitGitGadget wrote:\n\n> From: Derrick Stolee <stolee@gmail.com>\n>\n> Some large repositories use tags to track a huge list of release\n> versions. While this is choice is costly on the ref advertisement, it is\n\n\ts/is \\(choice is\\)/\\1/\n\n> further wasteful for clients who do not need those tags. Allow clients\n> to optionally skip the tag advertisement.\n>\n> [...]\n> diff --git a/Documentation/scalar.txt b/Documentation/scalar.txt\n> index 361f51a6473..507ed2ae669 100644\n> --- a/Documentation/scalar.txt\n> +++ b/Documentation/scalar.txt\n> @@ -86,6 +86,12 @@ cloning. If the HEAD at the remote did not point at any branch when\n>  \t`<entlistment>/src` directory. Use `--no-src` to place the cloned\n>  \trepository directly in the `<enlistment>` directory.\n>\n> +--[no-]tags::\n> +\tBy default, `scalar clone` will fetch the tag objects advertised by\n> +\tthe remote and future `git fetch` commands will do the same. Use\n\nIt might be helpful to mention that `git fetch --tags` can be used to\noverride this when the need arises.\n\n> +\t`--no-tags` to avoid fetching tags in `scalar clone` and to configure\n> +\tthe repository to avoid fetching tags in the future.\n> +\n>  --[no-]full-clone::\n>  \tA sparse-checkout is initialized by default. This behavior can be\n>  \tturned off via `--full-clone`.\n> diff --git a/scalar.c b/scalar.c\n> index 6166a8dd4c8..c6dd746b5b2 100644\n> --- a/scalar.c\n> +++ b/scalar.c\n> [...]\n> @@ -513,7 +520,9 @@ static int cmd_clone(int argc, const char **argv)\n>\n>  \tif ((res = run_git(\"fetch\", \"--quiet\",\n>  \t\t\t\tshow_progress ? \"--progress\" : \"--no-progress\",\n> -\t\t\t\t\"origin\", NULL))) {\n> +\t\t\t\t\"origin\",\n> +\t\t\t\t(!tags ? \"--no-tags\" : NULL),\n\nI find double negatives challenging, and would prefer this instead:\n\n\t\t\t\ttags ? NULL : \"--no-tags\",\n\n> +\t\t\t\tNULL))) {\n>  \t\twarning(_(\"partial clone failed; attempting full clone\"));\n>\n>  \t\tif (set_config(\"remote.origin.promisor\") ||\n> diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh\n> index a41b4fcc085..e8613990e13 100755\n> --- a/t/t9210-scalar.sh\n> +++ b/t/t9210-scalar.sh\n> @@ -169,6 +169,24 @@ test_expect_success 'scalar clone' '\n>  \t)\n>  '\n>\n> +test_expect_success 'scalar clone --no-... opts' '\n> +\t# Note: redirect stderr always to avoid having a verbose test\n> +\t# run result in a difference in the --[no-]progress option.\n> +\tGIT_TRACE2_EVENT=\"$(pwd)/no-opt-trace\" scalar clone \\\n> +\t\t--no-tags --no-src \\\n> +\t\t\"file://$(pwd)\" no-opts --single-branch 2>/dev/null &&\n> +\n> +\ttest_subcommand git fetch --quiet --no-progress \\\n> +\t\t\torigin --no-tags <no-opt-trace &&\n> +\t(\n> +\t\tcd no-opts &&\n> +\n> +\t\ttest_cmp_config --no-tags remote.origin.tagopt &&\n> +\t\tgit for-each-ref --format=\"%(refname)\" refs/tags/ >tags &&\n> +\t\ttest_line_count = 0 tags\n> +\t)\n\nFor readability (and to avoid an unnecessary subshell), this could be\nwritten as:\n\n\ttest_cmp_config -C no-opts --no-tags remote.origin.tagopt &&\n\tgit -C no-opts for-each-ref --format=\"%(refname)\" refs/tags/ >tags &&\n\ttest_line_count = 0 tags\n\n> +'\n> +\n>  test_expect_success 'scalar reconfigure' '\n>  \tgit init one/src &&\n>  \tscalar register one &&\n\nNone of these suggestions, in isolation or in conjunction, seem big enough\nto me to warrant a new iteration; I just offer them here in case you want\nto iterate on the patch. If you want to keep the patch as-is, I am totally\non board with that.\n\nCiao,\nJohannes\n"},{"id":"502331","messageId":"xmqqwmjoyfwh.fsf@gitster.g","threadId":"62065","inReplyTo":"58ca5257-2e56-830c-c85f-79e4c9e80858@gmx.de","subject":"Re: [PATCH] scalar: add --no-tags option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-09-06T15:13:02Z","receivedAt":"2024-09-06T15:13:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> None of these suggestions, in isolation or in conjunction, seem big enough\n> to me to warrant a new iteration; I just offer them here in case you want\n> to iterate on the patch. If you want to keep the patch as-is, I am totally\n> on board with that.\n\nEverything other than \"prefer repeated use of -C instead of a single\nsubshell in there\" (which I think worsens readability, even though\nit may save one process), I agree with your suggestions.\n\nThanks.\n"},{"id":"502346","messageId":"eaeb9ef8-d033-48ca-838c-25d1522e7afe@gmail.com","threadId":"62065","inReplyTo":"xmqqwmjoyfwh.fsf@gitster.g","subject":"Re: [PATCH] scalar: add --no-tags option","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2024-09-06T19:46:08Z","receivedAt":"2024-09-06T19:46:11Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 9/6/24 11:13 AM, Junio C Hamano wrote:\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n>> None of these suggestions, in isolation or in conjunction, seem big enough\n>> to me to warrant a new iteration; I just offer them here in case you want\n>> to iterate on the patch. If you want to keep the patch as-is, I am totally\n>> on board with that.\n> \n> Everything other than \"prefer repeated use of -C instead of a single\n> subshell in there\" (which I think worsens readability, even though\n> it may save one process), I agree with your suggestions.\nThanks, both, for your review comments. v2 is on the way with these\nsuggestions.\n\n-Stolee\n\n\n"},{"id":"502358","messageId":"pull.1780.v2.git.1725654102035.gitgitgadget@gmail.com","threadId":"62065","inReplyTo":"pull.1780.git.1725545614416.gitgitgadget@gmail.com","subject":"[PATCH v2] scalar: add --no-tags option to 'scalar clone'","fromName":"Derrick Stolee via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-09-06T20:21:41Z","receivedAt":"2024-09-06T20:21:46Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"From: Derrick Stolee <stolee@gmail.com>\n\nSome large repositories use tags to track a huge list of release\nversions. While this choice is costly on the ref advertisement, it is\nfurther wasteful for clients who do not need those tags. Allow clients\nto optionally skip the tag advertisement.\n\nThis behavior is similar to that of 'git clone --no-tags' implemented in\n0dab2468ee5 (clone: add a --no-tags option to clone without tags,\n2017-04-26), including the modification of the remote.origin.tagOpt\nconfig value to include \"--no-tags\".\n\nOne thing that is opposite of the 'git clone' implementation is that\nthis allows '--tags' as an assumed option, which can be naturally negated\nwith '--no-tags'. The clone command does not accept '--tags' but allows\n\"--no-no-tags\" as the negation of its '--no-tags' option.\n\nWhile testing this option, combine the test with the previously untested\n'--no-src' option introduced in 4527db8ff8c (scalar: add --[no-]src\noption, 2023-08-28).\n\nSigned-off-by: Derrick Stolee <stolee@gmail.com>\n---\n    scalar: add --no-tags option\n    \n    The need for this was discovered due to the release behavior of an\n    internal monorepo. The use of Azure DevOps' limited refs feature does\n    not apply to tags, so the number of tags was causing some pain for\n    users.\n    \n    Thanks, -Stolee\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1780%2Fderrickstolee%2Fscalar-no-tags-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1780/derrickstolee/scalar-no-tags-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1780\n\nRange-diff vs v1:\n\n 1:  f0e8217869a ! 1:  3378b4f728a scalar: add --no-tags option\n     @@ Metadata\n      Author: Derrick Stolee <dstolee@microsoft.com>\n      \n       ## Commit message ##\n     -    scalar: add --no-tags option\n     +    scalar: add --no-tags option to 'scalar clone'\n      \n          Some large repositories use tags to track a huge list of release\n     -    versions. While this is choice is costly on the ref advertisement, it is\n     +    versions. While this choice is costly on the ref advertisement, it is\n          further wasteful for clients who do not need those tags. Allow clients\n          to optionally skip the tag advertisement.\n      \n     @@ Documentation/scalar.txt: cloning. If the HEAD at the remote did not point at an\n      +\tBy default, `scalar clone` will fetch the tag objects advertised by\n      +\tthe remote and future `git fetch` commands will do the same. Use\n      +\t`--no-tags` to avoid fetching tags in `scalar clone` and to configure\n     -+\tthe repository to avoid fetching tags in the future.\n     ++\tthe repository to avoid fetching tags in the future. To fetch tags after\n     ++\tcloning with `--no-tags`, run `git fetch --tags`.\n      +\n       --[no-]full-clone::\n       \tA sparse-checkout is initialized by default. This behavior can be\n     @@ scalar.c: static int cmd_clone(int argc, const char **argv)\n       \t\t\t\tshow_progress ? \"--progress\" : \"--no-progress\",\n      -\t\t\t\t\"origin\", NULL))) {\n      +\t\t\t\t\"origin\",\n     -+\t\t\t\t(!tags ? \"--no-tags\" : NULL),\n     ++\t\t\t\t(tags ? NULL : \"--no-tags\"),\n      +\t\t\t\tNULL))) {\n       \t\twarning(_(\"partial clone failed; attempting full clone\"));\n       \n\n\n Documentation/scalar.txt |  7 +++++++\n scalar.c                 | 15 ++++++++++++---\n t/t9210-scalar.sh        | 18 ++++++++++++++++++\n 3 files changed, 37 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/scalar.txt b/Documentation/scalar.txt\nindex 361f51a6473..7e4259c6743 100644\n--- a/Documentation/scalar.txt\n+++ b/Documentation/scalar.txt\n@@ -86,6 +86,13 @@ cloning. If the HEAD at the remote did not point at any branch when\n \t`<entlistment>/src` directory. Use `--no-src` to place the cloned\n \trepository directly in the `<enlistment>` directory.\n \n+--[no-]tags::\n+\tBy default, `scalar clone` will fetch the tag objects advertised by\n+\tthe remote and future `git fetch` commands will do the same. Use\n+\t`--no-tags` to avoid fetching tags in `scalar clone` and to configure\n+\tthe repository to avoid fetching tags in the future. To fetch tags after\n+\tcloning with `--no-tags`, run `git fetch --tags`.\n+\n --[no-]full-clone::\n \tA sparse-checkout is initialized by default. This behavior can be\n \tturned off via `--full-clone`.\ndiff --git a/scalar.c b/scalar.c\nindex 6166a8dd4c8..09560aeab54 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -410,7 +410,7 @@ static int cmd_clone(int argc, const char **argv)\n {\n \tconst char *branch = NULL;\n \tint full_clone = 0, single_branch = 0, show_progress = isatty(2);\n-\tint src = 1;\n+\tint src = 1, tags = 1;\n \tstruct option clone_options[] = {\n \t\tOPT_STRING('b', \"branch\", &branch, N_(\"<branch>\"),\n \t\t\t   N_(\"branch to checkout after clone\")),\n@@ -421,11 +421,13 @@ static int cmd_clone(int argc, const char **argv)\n \t\t\t    \"be checked out\")),\n \t\tOPT_BOOL(0, \"src\", &src,\n \t\t\t N_(\"create repository within 'src' directory\")),\n+\t\tOPT_BOOL(0, \"tags\", &tags,\n+\t\t\t N_(\"specify if tags should be fetched during clone\")),\n \t\tOPT_END(),\n \t};\n \tconst char * const clone_usage[] = {\n \t\tN_(\"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\\n\"\n-\t\t   \"\\t[--[no-]src] <url> [<enlistment>]\"),\n+\t\t   \"\\t[--[no-]src] [--[no-]tags] <url> [<enlistment>]\"),\n \t\tNULL\n \t};\n \tconst char *url;\n@@ -504,6 +506,11 @@ static int cmd_clone(int argc, const char **argv)\n \t\tgoto cleanup;\n \t}\n \n+\tif (!tags && set_config(\"remote.origin.tagOpt=--no-tags\")) {\n+\t\tres = error(_(\"could not disable tags in '%s'\"), dir);\n+\t\tgoto cleanup;\n+\t}\n+\n \tif (!full_clone &&\n \t    (res = run_git(\"sparse-checkout\", \"init\", \"--cone\", NULL)))\n \t\tgoto cleanup;\n@@ -513,7 +520,9 @@ static int cmd_clone(int argc, const char **argv)\n \n \tif ((res = run_git(\"fetch\", \"--quiet\",\n \t\t\t\tshow_progress ? \"--progress\" : \"--no-progress\",\n-\t\t\t\t\"origin\", NULL))) {\n+\t\t\t\t\"origin\",\n+\t\t\t\t(tags ? NULL : \"--no-tags\"),\n+\t\t\t\tNULL))) {\n \t\twarning(_(\"partial clone failed; attempting full clone\"));\n \n \t\tif (set_config(\"remote.origin.promisor\") ||\ndiff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh\nindex a41b4fcc085..e8613990e13 100755\n--- a/t/t9210-scalar.sh\n+++ b/t/t9210-scalar.sh\n@@ -169,6 +169,24 @@ test_expect_success 'scalar clone' '\n \t)\n '\n \n+test_expect_success 'scalar clone --no-... opts' '\n+\t# Note: redirect stderr always to avoid having a verbose test\n+\t# run result in a difference in the --[no-]progress option.\n+\tGIT_TRACE2_EVENT=\"$(pwd)/no-opt-trace\" scalar clone \\\n+\t\t--no-tags --no-src \\\n+\t\t\"file://$(pwd)\" no-opts --single-branch 2>/dev/null &&\n+\n+\ttest_subcommand git fetch --quiet --no-progress \\\n+\t\t\torigin --no-tags <no-opt-trace &&\n+\t(\n+\t\tcd no-opts &&\n+\n+\t\ttest_cmp_config --no-tags remote.origin.tagopt &&\n+\t\tgit for-each-ref --format=\"%(refname)\" refs/tags/ >tags &&\n+\t\ttest_line_count = 0 tags\n+\t)\n+'\n+\n test_expect_success 'scalar reconfigure' '\n \tgit init one/src &&\n \tscalar register one &&\n\nbase-commit: 2e7b89e038c0c888acf61f1b4ee5a43d4dd5e94c\n-- \ngitgitgadget\n"}]}