{"thread":{"id":"53156","subject":"[PATCH] clone: document partial clone section","startedAt":"2020-04-02T02:02:32Z","lastAt":"2021-05-07T04:00:12Z","messageCount":24,"participants":["Teng Long via GitGitGadget","Derrick Stolee","Junio C Hamano","Derrick Stolee via GitGitGadget","Dyrone Teng via GitGitGadget","Philippe Blain","Teng Long","Bagas Sanjaya"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"394541","messageId":"pull.745.git.git.1585792946341.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":null,"subject":"[PATCH] clone: document partial clone section","fromName":"Teng Long via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-02T02:02:26Z","receivedAt":"2020-04-02T02:02:32Z","isPatch":true,"sender":{"key":"dyroneteng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7803958?v=4"},"body":"From: Dyrone Teng <dyroneteng@gmail.com>\n\nPartial clones are created using 'git clone', but there is no related\nhelp information in the git-clone documentation during a period. Add\na relevant section to help users understand what partial clones are\nand how they differ from normal clones.\n\nThe section briefly introduces the applicable scenarios and some\nprecautions of partial clone. If users want to know more about its\ntechnical design and other details, users can view the link of\ngit-partial-clone(7) according to the guidelines in the section.\n\nSigned-off-by: Teng Long <dyroneteng@gmail.com>\n---\n    clone: document partial clone section\n    \n    Partial clones are created using 'git clone', but there is no related\n    help information in the git-clone documentation during a period. Add a\n    relevant section to help users understand what partial clones are and\n    how they differ from normal clones.\n    \n    The section briefly introduces the applicable scenarios and some\n    precautions of partial clone. If users want to know more about its\n    technical design and other details, users can view the link of\n    git-partial-clone(7) according to the guidelines in the section.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v1\nPull-Request: https://github.com/git/git/pull/745\n\n Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex bf24f1813ad..dd92d153535 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -297,6 +297,75 @@ or `--mirror` is given)\n \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n \tis only allowed if the directory is empty.\n \n+Partial Clone\n+-------------\n+\n+By default, `git clone` will download every reachable object, including\n+every version of every file in the history of the repository. The **partial clone**\n+feature allows Git to transfer fewer objects and request them from the\n+remote only when they are needed, so some reachable objects can be\n+omitted from the initial `git clone` and subsequent `git fetch`\n+operations. In this way, a partial clone can reduce the network traffic\n+costs and disk space usage when git is working under a large repository.\n+\n+To use the partial clone feature, you can run `git clone` with the \n+`--filter=<filter-spec>` option. If the repository has a deep history\n+and you don't want to download any blobs, the form `filter=blob:none`\n+will omit all the blobs. If the repository has some large blobs and you\n+want to prevent some large blobs being downloaded by an appropriate\n+threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n+than n bytes or units (see linkgit:git-rev-list[1]).\n+\n+When using a partial clone, Git will request missing objects from the\n+remote(s) when necessary. Several commands that do not involve a request\n+over a network may now trigger these requests.\n+\n+For example, The <repository> contains two branches which names 'master'\n+and 'topic. Then, we clone the repository by\n+\n+    $ git clone --filter=blob:none --no-checkout <repository>\n+\n+With the `--filter=blob:none` option Git will omit all the blobs and\n+the `--no-checkout` option Git will not perform a checkout of HEAD\n+after the clone is complete. Then, we check out the remote tracking\n+'topic' branch by\n+\n+    $ git checkout -b topic origin/topic \n+\n+The output looks like\n+\n+------------\n+    remote: Enumerating objects: 1, done.\n+    remote: Counting objects: 100% (1/1), done.\n+    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n+    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n+    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n+    Switched to a new branch 'topic'\n+------------\n+\n+The output is a bit surprising but it shows how partial clone works.\n+When we check out the branch 'topic' Git will request the missing blobs\n+because they are needed. Then, We can switch back to branch 'master' by\n+\n+    $ git checkout master\n+\n+This time the output looks like\n+\n+------------\n+    Switched to branch 'master'\n+    Your branch is up to date with 'origin/master'.\n+------------\n+\n+It shows that when we switch back to the previous location, the checkout\n+is done without a download because the repository has all the blobs that\n+were downloaded previously.\n+\n+`git log` may also make a surprise with partial clones. `git log\n+--<path>` will not cause downloads with the blob filters, because it's\n+only reading commits. `git log -p -- <path>` will download blobs to\n+generate the patch output and git log --raw will download all blobs\n+that changed at recent commits in order to compute renames.\n+\n :git-clone: 1\n include::urls.txt[]\n \n\nbase-commit: 9fadedd637b312089337d73c3ed8447e9f0aa775\n-- \ngitgitgadget\n"},{"id":"394564","messageId":"f5787308-a673-7356-6d9e-f226954e1310@gmail.com","threadId":"53156","inReplyTo":"pull.745.git.git.1585792946341.gitgitgadget@gmail.com","subject":"Re: [PATCH] clone: document partial clone section","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2020-04-02T11:29:58Z","receivedAt":"2020-04-02T11:30:04Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/1/2020 10:02 PM, Teng Long via GitGitGadget wrote:\n> From: Dyrone Teng <dyroneteng@gmail.com>\n> \n> Partial clones are created using 'git clone', but there is no related\n> help information in the git-clone documentation during a period. Add\n> a relevant section to help users understand what partial clones are\n> and how they differ from normal clones.\n> \n> The section briefly introduces the applicable scenarios and some\n> precautions of partial clone. If users want to know more about its\n> technical design and other details, users can view the link of\n> git-partial-clone(7) according to the guidelines in the section.\nEveryone, meet Dyrone! Dyrone volunteered to work on the partial\nclone documentation after I reached out on Twitter. We did one\nround of internal review before this submission.\n\nDyrone, do you want to introduce yourself a bit more to the\ncommunity?\n\n> From: Dyrone Teng <dyroneteng@gmail.com>\n> Signed-off-by: Teng Long <dyroneteng@gmail.com>\n\nAnd a small thing: we prefer the sign-off to match the author\ninformation at the top. These are at least the same email\naddress, so that's good.\n\nThanks,\n-Stolee\n\n"},{"id":"394608","messageId":"xmqqa73t4wmk.fsf@gitster.c.googlers.com","threadId":"53156","inReplyTo":"pull.745.git.git.1585792946341.gitgitgadget@gmail.com","subject":"Re: [PATCH] clone: document partial clone section","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-02T17:37:23Z","receivedAt":"2020-04-02T17:37:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Teng Long via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Dyrone Teng <dyroneteng@gmail.com>\n>\n> Partial clones are created using 'git clone', but there is no related\n> help information in the git-clone documentation during a period. Add\n> a relevant section to help users understand what partial clones are\n> and how they differ from normal clones.\n\nI am not sure what \"during a period\" means there; perhaps we can\nsimplydrop these three words to make the sentence clearer without\nchanging what you wanted to say?\n\n> The section briefly introduces the applicable scenarios and some\n> precautions of partial clone. If users want to know more about its\n> technical design and other details, users can view the link of\n> git-partial-clone(7) according to the guidelines in the section.\n\nOtherwise, the above is a nice and clearly written summary.\n\n> Signed-off-by: Teng Long <dyroneteng@gmail.com>\n\nAs Derrick pointed out, we want to see the authors sign their\npatches using the same authors' name on this line.\n\n> diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\n> index bf24f1813ad..dd92d153535 100644\n> --- a/Documentation/git-clone.txt\n> +++ b/Documentation/git-clone.txt\n> @@ -297,6 +297,75 @@ or `--mirror` is given)\n>  \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n>  \tis only allowed if the directory is empty.\n>  \n> +Partial Clone\n> +-------------\n> +\n> +By default, `git clone` will download every reachable object, including\n> +every version of every file in the history of the repository. The **partial clone**\n\nPlease avoid overly long lines.\n\n> +... omitted from the initial `git clone` and subsequent `git fetch`\n> +operations. In this way, a partial clone can reduce the network traffic\n> +costs and disk space usage when git is working under a large repository.\n\nPerhaps \"can reduce the initial network traffic costs...\", as you'd\nend up paying the cost for the part of the repository you'd actually\nuse.\n\nAnd there is traffic and disk usage reduction that comes but not \"in\nthis way (i.e. initial clone does not have to transfer)\", which is\nthat parts of the trees and histories you never touch may not have\nto be transferred and stored at all.  If you meant to cover benefits\ncoming from both reasons, perhaps omit \"In this way, \" and then\nwe do not have to say \"the initial network traffic costs...\".  Or\nyou may want to spell out both a bit more explicitly.\n\n> +To use the partial clone feature, you can run `git clone` with the \n> +`--filter=<filter-spec>` option. If the repository has a deep history\n> +and you don't want to download any blobs, the form `filter=blob:none`\n> +will omit all the blobs.\n\nIf the repository of a young project simply has a large collection\nof files, blob:none would still omit all the blobs, so I am not sure\nif \"the repository has a deep history and\" is a good thing to say.\n\n> +When using a partial clone, Git will request missing objects from the\n> +remote(s) when necessary. Several commands that do not involve a request\n> +over a network may now trigger these requests.\n\nWe may want to phrase this a bit stronger, if you are listing these\nas pros-and-cons?  E.g. \"Some 'local' commands may fail without a\nnetwork connection to the remote repository.\"\n\n> +For example, The <repository> contains two branches which names 'master'\n> +and 'topic. Then, we clone the repository by\n> +\n> +    $ git clone --filter=blob:none --no-checkout <repository>\n> +\n> +With the `--filter=blob:none` option Git will omit all the blobs and\n> +the `--no-checkout` option Git will not perform a checkout of HEAD\n> +after the clone is complete. Then, we check out the remote tracking\n> +'topic' branch by\n> +\n> +    $ git checkout -b topic origin/topic \n> +\n> +The output looks like\n> +\n> +------------\n> +    remote: Enumerating objects: 1, done.\n> +    remote: Counting objects: 100% (1/1), done.\n> +    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n> +    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n> +    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n> +    Switched to a new branch 'topic'\n> +------------\n> +\n> +The output is a bit surprising but it shows how partial clone works.\n> +When we check out the branch 'topic' Git will request the missing blobs\n> +because they are needed. Then, We can switch back to branch 'master' by\n> +\n> +    $ git checkout master\n> +\n> +This time the output looks like\n> +\n> +------------\n> +    Switched to branch 'master'\n> +    Your branch is up to date with 'origin/master'.\n> +------------\n> +\n> +It shows that when we switch back to the previous location, the checkout\n> +is done without a download because the repository has all the blobs that\n> +were downloaded previously.\n\nGood illusration.  Nicely done.\n\n> +`git log` may also make a surprise with partial clones. `git log\n> +--<path>` will not cause downloads with the blob filters, because it's\n\nYou meant to leave a SP between double-dash and <pathspec> (these\nthings are called <pathspec> and not necessarily a <path>, so use\nthe right word) here.\n\n> +only reading commits.\n\nThis is incorrect.  A pathspec limited \"log\" reads both commits and\ntrees.  Luckily, that does not change the conclusion---a blob-less\npartial clone already has all tree objects in addition to commit\nobjects, so there is no need for lazy/on-demand fetching.\n\n> `git log -p -- <path>` will download blobs to\n> +generate the patch output and git log --raw will download all blobs\n> +that changed at recent commits in order to compute renames.\n\nI do not know anybody sane uses '--raw' these days, but a better\nway to describe this may be\n\n    In addition to any options that require git to look at the\n    contents of blobs, like \"-p\" and \"--stat\", options that cause\n    git to report pathnames, like \"--summary\" and \"--raw\", will\n    trigger lazy/on-demand fetching of blobs, as they are needed to\n    detect inexact renames.\n\nThanks.\n"},{"id":"394613","messageId":"120c8b18-6707-ce8e-7905-8f9565094034@gmail.com","threadId":"53156","inReplyTo":"xmqqa73t4wmk.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] clone: document partial clone section","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2020-04-02T17:52:53Z","receivedAt":"2020-04-02T17:52:57Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/2/2020 1:37 PM, Junio C Hamano wrote:\n>> `git log -p -- <path>` will download blobs to\n>> +generate the patch output and git log --raw will download all blobs\n>> +that changed at recent commits in order to compute renames.\n> I do not know anybody sane uses '--raw' these days, but a better\n> way to describe this may be\n\nHa. This was my fault for recommending it. The point was that some\ndiff options require blob contents even if it doesn't seem obvious.\nYes, \"-p\" will get contents to show the in-file diff, but --raw\nwill calculate renames so it can show the rename in the output.\n\nWhen I use '--raw' what I really care about is '--name-only' but\ndoes that compute renames?\n\nAs you mention, '--summary' would suffice for the point as it\nchecks for renames.\n\nThanks,\n-Stolee\n"},{"id":"395342","messageId":"6f340d9aadf71d394ad320ad162f1d140b632f2c.1586791560.git.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":"pull.745.v2.git.git.1586791560.gitgitgadget@gmail.com","subject":"[PATCH v2 1/3] partial-clone: set default filter with --partial","fromName":"Derrick Stolee via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-13T15:25:58Z","receivedAt":"2020-04-13T15:26:07Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"From: Derrick Stolee <dstolee@microsoft.com>\n\nPartial clone means a lot of different things, including filtering\nout all blobs, large blobs, or objects along a certain pathspec.\nThe pathspec option has limited uses, in particular due to the\nperformance challenges in serving with such filters. The blob size\noption can be helpful for repositories with a small number of large\nbinaries, but otherwise it is difficult to find a meaningful split\nbetween \"small\" and \"large\" blobs.\n\nWhen I think of or recommend partial clone, I specifically mention\nthe case of filtering out all blobs, and downloading those blobs\nonly as needed.\n\nThis case is extremely useful, since it takes the best part of\nshallow clone (a very small initial download) without any of the\ndownsides of restricted history.\n\nHowever, the command-line interface can be confusing:\n\n\tgit clone --filter=blob:none <url>\n\nAdd a simpler \"--partial\" option that defaults to this case:\n\n\tgit clone --partial <url>\n\nThis should make the feature more discoverable. However, there is\na significant interest in the size-limited filters as that behaves\nvery similarly to Git LFS. For those cases, the following is\navailable:\n\n\tgit clone --partial=<size> <url>\n\nThere are quite a few commands using OPT_PARSE_LIST_OBJECTS_FILTER,\nincludeing clone, fetch, and pack-objects. Augment this macro to\ninclude the \"--partial[=<size>]\" mode for free.\n\nModify the first partial clone test that checks --filter=blob:none\nto also check --partial with the same expected conditions after\nclone. The diff is much simpler to see when ignoring whitespace,\nsince several lines added a leading tab. This test is essentially\ncopied to include the two ways to specify a blob size limit of\none byte.\n\nSigned-off-by: Derrick Stolee <dstolee@microsoft.com>\n---\n list-objects-filter-options.c | 18 +++++++++++++++\n list-objects-filter-options.h |  8 ++++++-\n t/t5616-partial-clone.sh      | 42 ++++++++++++++++++++++++++---------\n 3 files changed, 57 insertions(+), 11 deletions(-)\n\ndiff --git a/list-objects-filter-options.c b/list-objects-filter-options.c\nindex 256bcfbdfe6..a71716ef75e 100644\n--- a/list-objects-filter-options.c\n+++ b/list-objects-filter-options.c\n@@ -270,6 +270,24 @@ int opt_parse_list_objects_filter(const struct option *opt,\n \treturn 0;\n }\n \n+int opt_set_blob_none_filter(const struct option *opt,\n+\t\t\t     const char *arg, int unset)\n+{\n+\tstruct strbuf filter_arg = STRBUF_INIT;\n+\tstruct list_objects_filter_options *filter_options = opt->value;\n+\t\n+\tif (unset || !arg || !strcmp(arg, \"0\")) {\n+\t\tparse_list_objects_filter(filter_options, \"blob:none\");\n+\t\treturn 0;\n+\t}\n+\t\n+\tstrbuf_addf(&filter_arg, \"blob:limit=%s\", arg);\n+\tparse_list_objects_filter(filter_options, filter_arg.buf);\n+\tstrbuf_release(&filter_arg);\n+\n+\treturn 0;\n+}\n+\n const char *list_objects_filter_spec(struct list_objects_filter_options *filter)\n {\n \tif (!filter->filter_spec.nr)\ndiff --git a/list-objects-filter-options.h b/list-objects-filter-options.h\nindex 2ffb39222c4..ac38ffcbe86 100644\n--- a/list-objects-filter-options.h\n+++ b/list-objects-filter-options.h\n@@ -62,6 +62,7 @@ struct list_objects_filter_options {\n \n /* Normalized command line arguments */\n #define CL_ARG__FILTER \"filter\"\n+#define CL_ARG__PARTIAL \"partial\"\n \n void list_objects_filter_die_if_populated(\n \tstruct list_objects_filter_options *filter_options);\n@@ -80,11 +81,16 @@ void parse_list_objects_filter(\n \n int opt_parse_list_objects_filter(const struct option *opt,\n \t\t\t\t  const char *arg, int unset);\n+int opt_set_blob_none_filter(const struct option *opt,\n+\t\t\t     const char *arg, int unset);\n \n #define OPT_PARSE_LIST_OBJECTS_FILTER(fo) \\\n \t{ OPTION_CALLBACK, 0, CL_ARG__FILTER, fo, N_(\"args\"), \\\n \t  N_(\"object filtering\"), 0, \\\n-\t  opt_parse_list_objects_filter }\n+\t  opt_parse_list_objects_filter }, \\\n+\t{ OPTION_CALLBACK, 0, CL_ARG__PARTIAL, fo, N_(\"size\"), \\\n+\t  N_(\"partial clone with blob filter\"), \\\n+\t  PARSE_OPT_OPTARG | PARSE_OPT_NONEG , opt_set_blob_none_filter }\n \n /*\n  * Translates abbreviated numbers in the filter's filter_spec into their\ndiff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh\nindex 77bb91e9769..c42cef61296 100755\n--- a/t/t5616-partial-clone.sh\n+++ b/t/t5616-partial-clone.sh\n@@ -33,17 +33,39 @@ test_expect_success 'setup bare clone for server' '\n # confirm we are missing all of the known blobs.\n # confirm partial clone was registered in the local config.\n test_expect_success 'do partial clone 1' '\n-\tgit clone --no-checkout --filter=blob:none \"file://$(pwd)/srv.bare\" pc1 &&\n-\n-\tgit -C pc1 rev-list --quiet --objects --missing=print HEAD >revs &&\n-\tawk -f print_1.awk revs |\n-\tsed \"s/?//\" |\n-\tsort >observed.oids &&\n+\tfor option in \"--filter=blob:none\" \"--partial\"\n+\tdo\n+\t\trm -rf pc1 &&\n+\t\tgit clone --no-checkout \"$option\" \"file://$(pwd)/srv.bare\" pc1 &&\n+\n+\t\tgit -C pc1 rev-list --quiet --objects --missing=print HEAD >revs &&\n+\t\tawk -f print_1.awk revs |\n+\t\tsed \"s/?//\" |\n+\t\tsort >observed.oids &&\n+\n+\t\ttest_cmp expect_1.oids observed.oids &&\n+\t\ttest \"$(git -C pc1 config --local core.repositoryformatversion)\" = \"1\" &&\n+\t\ttest \"$(git -C pc1 config --local remote.origin.promisor)\" = \"true\" &&\n+\t\ttest \"$(git -C pc1 config --local remote.origin.partialclonefilter)\" = \"blob:none\"\n+\tdone\n+'\n \n-\ttest_cmp expect_1.oids observed.oids &&\n-\ttest \"$(git -C pc1 config --local core.repositoryformatversion)\" = \"1\" &&\n-\ttest \"$(git -C pc1 config --local remote.origin.promisor)\" = \"true\" &&\n-\ttest \"$(git -C pc1 config --local remote.origin.partialclonefilter)\" = \"blob:none\"\n+test_expect_success 'do partial clone with size limit' '\n+\tfor option in \"--filter=blob:limit=1\" \"--partial=1\"\n+\tdo\n+\t\trm -rf pc-limit &&\n+\t\tgit clone --no-checkout \"$option\" \"file://$(pwd)/srv.bare\" pc-limit &&\n+\n+\t\tgit -C pc-limit rev-list --quiet --objects --missing=print HEAD >revs &&\n+\t\tawk -f print_1.awk revs |\n+\t\tsed \"s/?//\" |\n+\t\tsort >observed.oids &&\n+\n+\t\ttest_cmp expect_1.oids observed.oids &&\n+\t\ttest \"$(git -C pc-limit config --local core.repositoryformatversion)\" = \"1\" &&\n+\t\ttest \"$(git -C pc-limit config --local remote.origin.promisor)\" = \"true\" &&\n+\t\ttest \"$(git -C pc-limit config --local remote.origin.partialclonefilter)\" = \"blob:limit=1\"\n+\tdone\n '\n \n test_expect_success 'verify that .promisor file contains refs fetched' '\n-- \ngitgitgadget\n\n"},{"id":"395343","messageId":"9baf4c8ba383414e41d3d7726cf40c39cbf197e7.1586791560.git.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":"pull.745.v2.git.git.1586791560.gitgitgadget@gmail.com","subject":"[PATCH v2 2/3] clone: document --partial and --filter options","fromName":"Derrick Stolee via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-13T15:25:59Z","receivedAt":"2020-04-13T15:26:09Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"From: Derrick Stolee <dstolee@microsoft.com>\n\nThe previous change added the \"--partial[=<size>]\" option to\n\"git clone\" equivalent to \"--filter=blob:none\" or\n\"--filter=blob:limit=<size>\" but did not document that addition.\nIt turns out that the \"--filter=<filter-spec>\" option was not\ndocumented anywhere in the \"git clone\" page, and instead is\ndetailed carefully in \"git rev-list\" where it serves a\ndifferent purpose.\n\nAdd a small bit about these options in the documentation. It\nwould be worth some time to create a subsection in the \"git clone\"\ndocumentation about partial clone as a concept and how it can be\na surprising experience. For example, \"git checkout\" will likely\ntrigger a pack download.\n\nSigned-off-by: Derrick Stolee <dstolee@microsoft.com>\n---\n Documentation/git-clone.txt | 15 ++++++++++++++-\n 1 file changed, 14 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex bf24f1813ad..eafa1c39927 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -15,7 +15,8 @@ SYNOPSIS\n \t  [--dissociate] [--separate-git-dir <git dir>]\n \t  [--depth <depth>] [--[no-]single-branch] [--no-tags]\n \t  [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules]\n-\t  [--[no-]remote-submodules] [--jobs <n>] [--sparse] [--] <repository>\n+\t  [--[no-]remote-submodules] [--jobs <n>] [--sparse]\n+\t  [--partial[=<size>]|--filter=<filter>] [--] <repository>\n \t  [<directory>]\n \n DESCRIPTION\n@@ -162,6 +163,18 @@ objects from the source repository into a pack in the cloned repository.\n \tof the repository. The sparse-checkout file can be\n \tmodified to grow the working directory as needed.\n \n+--partial[=<size>]::\n+--filter=<filter-spec>::\n+\tUse the partial clone feature and request that the server sends\n+\ta subset of reachable objects according to a given object filter.\n+\tWhen using `--filter`, the supplied `<filter-spec>` is used for\n+\tthe partial clone filter. When using `--partial` with no `<size>`,\n+\tthe `blob:none` filter is applied to filter all blobs. When using\n+\t`--partial=<size>` the `blob:limit=<size>` filter is applied to\n+\tfilter all blobs with size larger than `<size>`. For more details\n+\ton filter specifications, see the `--filter` option in\n+\tlinkgit:git-rev-list[1].\n+\n --mirror::\n \tSet up a mirror of the source repository.  This implies `--bare`.\n \tCompared to `--bare`, `--mirror` not only maps local branches of the\n-- \ngitgitgadget\n\n"},{"id":"395344","messageId":"pull.745.v2.git.git.1586791560.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":"pull.745.git.git.1585792946341.gitgitgadget@gmail.com","subject":"[PATCH v2 0/3] clone: document partial clone section","fromName":"Teng Long via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-13T15:25:57Z","receivedAt":"2020-04-13T15:26:09Z","isPatch":true,"sender":{"key":"dyroneteng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7803958?v=4"},"body":"Partial clones are created using 'git clone', but there is no related help\ninformation in the git-clone documentation during a period. Add a relevant\nsection to help users understand what partial clones are and how they differ\nfrom normal clones.\n\nThe section briefly introduces the applicable scenarios and some precautions\nof partial clone. If users want to know more about its technical design and\nother details, users can view the link of git-partial-clone(7) according to\nthe guidelines in the section.\n\nDerrick Stolee (2):\n  partial-clone: set default filter with --partial\n  clone: document --partial and --filter options\n\nDyrone Teng (1):\n  clone: document partial clone section\n\n Documentation/git-clone.txt   | 87 ++++++++++++++++++++++++++++++++++-\n list-objects-filter-options.c | 18 ++++++++\n list-objects-filter-options.h |  8 +++-\n t/t5616-partial-clone.sh      | 42 +++++++++++++----\n 4 files changed, 143 insertions(+), 12 deletions(-)\n\n\nbase-commit: 6c85aac65fb455af85745130ce35ddae4678db84\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v2\nPull-Request: https://github.com/git/git/pull/745\n\nRange-diff vs v1:\n\n -:  ----------- > 1:  6f340d9aadf partial-clone: set default filter with --partial\n -:  ----------- > 2:  9baf4c8ba38 clone: document --partial and --filter options\n 1:  f063efa545b ! 3:  c1a44a35095 clone: document partial clone section\n     @@ Commit message\n          clone: document partial clone section\n      \n          Partial clones are created using 'git clone', but there is no related\n     -    help information in the git-clone documentation during a period. Add\n     -    a relevant section to help users understand what partial clones are\n     -    and how they differ from normal clones.\n     +    help information in the git-clone documentation. Add a relevant section\n     +    to help users understand what partial clones are and how they differ\n     +    from normal clones.\n      \n          The section briefly introduces the applicable scenarios and some\n          precautions of partial clone. If users want to know more about its\n          technical design and other details, users can view the link of\n          git-partial-clone(7) according to the guidelines in the section.\n      \n     -    Signed-off-by: Teng Long <dyroneteng@gmail.com>\n     +    Signed-off-by: Dyrone Teng <dyroneteng@gmail.com>\n      \n       ## Documentation/git-clone.txt ##\n      @@ Documentation/git-clone.txt: or `--mirror` is given)\n     @@ Documentation/git-clone.txt: or `--mirror` is given)\n      +-------------\n      +\n      +By default, `git clone` will download every reachable object, including\n     -+every version of every file in the history of the repository. The **partial clone**\n     -+feature allows Git to transfer fewer objects and request them from the\n     -+remote only when they are needed, so some reachable objects can be\n     -+omitted from the initial `git clone` and subsequent `git fetch`\n     -+operations. In this way, a partial clone can reduce the network traffic\n     -+costs and disk space usage when git is working under a large repository.\n     ++every version of every file in the history of the repository. The\n     ++**partial clone** feature allows Git to transfer fewer objects and\n     ++request them from the remote only when they are needed, so some\n     ++reachable objects can be omitted from the initial `git clone` and\n     ++subsequent `git fetch` operations.\n      +\n      +To use the partial clone feature, you can run `git clone` with the \n     -+`--filter=<filter-spec>` option. If the repository has a deep history\n     -+and you don't want to download any blobs, the form `filter=blob:none`\n     -+will omit all the blobs. If the repository has some large blobs and you\n     -+want to prevent some large blobs being downloaded by an appropriate\n     -+threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n     -+than n bytes or units (see linkgit:git-rev-list[1]).\n     ++`--filter=<filter-spec>` option. If you want to clone a repository\n     ++without download any blobs, the form `filter=blob:none` will omit all\n     ++the blobs. If the repository has some large blobs and you want to\n     ++prevent some large blobs being downloaded by an appropriate threshold,\n     ++the form `--filter=blob:limit=<n>[kmg]`omits blobs larger than n bytes\n     ++or units (see linkgit:git-rev-list[1]).\n      +\n     -+When using a partial clone, Git will request missing objects from the\n     -+remote(s) when necessary. Several commands that do not involve a request\n     -+over a network may now trigger these requests.\n     ++As mentioned before, a partially cloned repository may have to request\n     ++the missing objects when they are needed. So some 'local' commands may\n     ++fail without a network connection to the remote repository.\n      +\n      +For example, The <repository> contains two branches which names 'master'\n      +and 'topic. Then, we clone the repository by\n     @@ Documentation/git-clone.txt: or `--mirror` is given)\n      +were downloaded previously.\n      +\n      +`git log` may also make a surprise with partial clones. `git log\n     -+--<path>` will not cause downloads with the blob filters, because it's\n     -+only reading commits. `git log -p -- <path>` will download blobs to\n     -+generate the patch output and git log --raw will download all blobs\n     -+that changed at recent commits in order to compute renames.\n     ++-- <pathspec>` will not cause downloads with the blob filters, because\n     ++it's only reading commits and trees. In addition to any options that\n     ++require git to look at the contents of blobs, like \"-p\" and \"--stat\"\n     ++, options that cause git to report pathnames, like \"--summary\" and\n     ++\"--raw\", will trigger lazy/on-demand fetching of blobs, as they are\n     ++needed to detect inexact renames.\n     ++\n     ++linkgit:partial-clone[1]\n      +\n       :git-clone: 1\n       include::urls.txt[]\n\n-- \ngitgitgadget\n"},{"id":"395345","messageId":"c1a44a35095e7d681c312ecaa07c46e49f2fae67.1586791560.git.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":"pull.745.v2.git.git.1586791560.gitgitgadget@gmail.com","subject":"[PATCH v2 3/3] clone: document partial clone section","fromName":"Dyrone Teng via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-13T15:26:00Z","receivedAt":"2020-04-13T15:26:15Z","isPatch":true,"sender":{"key":"name:Dyrone Teng","avatar":null},"body":"From: Dyrone Teng <dyroneteng@gmail.com>\n\nPartial clones are created using 'git clone', but there is no related\nhelp information in the git-clone documentation. Add a relevant section\nto help users understand what partial clones are and how they differ\nfrom normal clones.\n\nThe section briefly introduces the applicable scenarios and some\nprecautions of partial clone. If users want to know more about its\ntechnical design and other details, users can view the link of\ngit-partial-clone(7) according to the guidelines in the section.\n\nSigned-off-by: Dyrone Teng <dyroneteng@gmail.com>\n---\n Documentation/git-clone.txt | 72 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 72 insertions(+)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex eafa1c39927..a6e13666ea1 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -310,6 +310,78 @@ or `--mirror` is given)\n \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n \tis only allowed if the directory is empty.\n \n+Partial Clone\n+-------------\n+\n+By default, `git clone` will download every reachable object, including\n+every version of every file in the history of the repository. The\n+**partial clone** feature allows Git to transfer fewer objects and\n+request them from the remote only when they are needed, so some\n+reachable objects can be omitted from the initial `git clone` and\n+subsequent `git fetch` operations.\n+\n+To use the partial clone feature, you can run `git clone` with the \n+`--filter=<filter-spec>` option. If you want to clone a repository\n+without download any blobs, the form `filter=blob:none` will omit all\n+the blobs. If the repository has some large blobs and you want to\n+prevent some large blobs being downloaded by an appropriate threshold,\n+the form `--filter=blob:limit=<n>[kmg]`omits blobs larger than n bytes\n+or units (see linkgit:git-rev-list[1]).\n+\n+As mentioned before, a partially cloned repository may have to request\n+the missing objects when they are needed. So some 'local' commands may\n+fail without a network connection to the remote repository.\n+\n+For example, The <repository> contains two branches which names 'master'\n+and 'topic. Then, we clone the repository by\n+\n+    $ git clone --filter=blob:none --no-checkout <repository>\n+\n+With the `--filter=blob:none` option Git will omit all the blobs and\n+the `--no-checkout` option Git will not perform a checkout of HEAD\n+after the clone is complete. Then, we check out the remote tracking\n+'topic' branch by\n+\n+    $ git checkout -b topic origin/topic \n+\n+The output looks like\n+\n+------------\n+    remote: Enumerating objects: 1, done.\n+    remote: Counting objects: 100% (1/1), done.\n+    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n+    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n+    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n+    Switched to a new branch 'topic'\n+------------\n+\n+The output is a bit surprising but it shows how partial clone works.\n+When we check out the branch 'topic' Git will request the missing blobs\n+because they are needed. Then, We can switch back to branch 'master' by\n+\n+    $ git checkout master\n+\n+This time the output looks like\n+\n+------------\n+    Switched to branch 'master'\n+    Your branch is up to date with 'origin/master'.\n+------------\n+\n+It shows that when we switch back to the previous location, the checkout\n+is done without a download because the repository has all the blobs that\n+were downloaded previously.\n+\n+`git log` may also make a surprise with partial clones. `git log\n+-- <pathspec>` will not cause downloads with the blob filters, because\n+it's only reading commits and trees. In addition to any options that\n+require git to look at the contents of blobs, like \"-p\" and \"--stat\"\n+, options that cause git to report pathnames, like \"--summary\" and\n+\"--raw\", will trigger lazy/on-demand fetching of blobs, as they are\n+needed to detect inexact renames.\n+\n+linkgit:partial-clone[1]\n+\n :git-clone: 1\n include::urls.txt[]\n \n-- \ngitgitgadget\n"},{"id":"395380","messageId":"xmqqd08batub.fsf@gitster.c.googlers.com","threadId":"53156","inReplyTo":"pull.745.v2.git.git.1586791560.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 0/3] clone: document partial clone section","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-13T22:45:00Z","receivedAt":"2020-04-13T22:51:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Teng Long via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> Partial clones are created using 'git clone', but there is no related help\n> information in the git-clone documentation during a period. Add a relevant\n> section to help users understand what partial clones are and how they differ\n> from normal clones.\n>\n> The section briefly introduces the applicable scenarios and some precautions\n> of partial clone. If users want to know more about its technical design and\n> other details, users can view the link of git-partial-clone(7) according to\n> the guidelines in the section.\n>\n> Derrick Stolee (2):\n>   partial-clone: set default filter with --partial\n>   clone: document --partial and --filter options\n>\n> Dyrone Teng (1):\n>   clone: document partial clone section\n\n> base-commit: 6c85aac65fb455af85745130ce35ddae4678db84\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v2\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v2\n> Pull-Request: https://github.com/git/git/pull/745\n>\n> Range-diff vs v1:\n\nCan you remind readers which thread was the v1?  Hopefully it is not\nthis one, right?\n\n  https://lore.kernel.org/git/20200322192234.GC671552@coredump.intra.peff.net/\n\nit concluded that it is not a great idea to set default filter with\n\"--partial\", and the discussion led to a v2 with a reduced scope at\n\n  https://lore.kernel.org/git/pull.586.v2.git.1584906606469.gitgitgadget@gmail.com/\n\nand that one is already cooking.\n\n>  -:  ----------- > 1:  6f340d9aadf partial-clone: set default filter with --partial\n>  -:  ----------- > 2:  9baf4c8ba38 clone: document --partial and --filter options\n>  1:  f063efa545b ! 3:  c1a44a35095 clone: document partial clone section\n\nThanks.\n"},{"id":"395410","messageId":"90b62982-2e91-9846-e6c1-fc25016456b8@gmail.com","threadId":"53156","inReplyTo":"pull.745.v2.git.git.1586791560.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 0/3] clone: document partial clone section","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2020-04-14T13:42:05Z","receivedAt":"2020-04-14T13:42:16Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/13/2020 11:25 AM, Teng Long via GitGitGadget wrote:\n> Derrick Stolee (2):\n>   partial-clone: set default filter with --partial\n>   clone: document --partial and --filter options\n\nI believe these two commits got submitted by accident, as they were in my branch before and then were removed based on feedback from the list [1].\n\nDyrone: before sending your next version, please eject these two commits. You can do this with \"git rebase --onto HEAD~3 HEAD~1 <branchname>\".\n\nThanks,\n-Stolee\n\n[1] https://lore.kernel.org/git/pull.586.v2.git.1584906606469.gitgitgadget@gmail.com/\n"},{"id":"395411","messageId":"e77309ef-68a4-0ebd-0d82-051b07838fd5@gmail.com","threadId":"53156","inReplyTo":"xmqqd08batub.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v2 0/3] clone: document partial clone section","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2020-04-14T13:43:42Z","receivedAt":"2020-04-14T13:43:51Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/13/2020 6:45 PM, Junio C Hamano wrote:\n> \"Teng Long via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n>> Partial clones are created using 'git clone', but there is no related help\n>> information in the git-clone documentation during a period. Add a relevant\n>> section to help users understand what partial clones are and how they differ\n>> from normal clones.\n>>\n>> The section briefly introduces the applicable scenarios and some precautions\n>> of partial clone. If users want to know more about its technical design and\n>> other details, users can view the link of git-partial-clone(7) according to\n>> the guidelines in the section.\n>>\n>> Derrick Stolee (2):\n>>   partial-clone: set default filter with --partial\n>>   clone: document --partial and --filter options\n>>\n>> Dyrone Teng (1):\n>>   clone: document partial clone section\n> \n>> base-commit: 6c85aac65fb455af85745130ce35ddae4678db84\n>> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v2\n>> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v2\n>> Pull-Request: https://github.com/git/git/pull/745\n>>\n>> Range-diff vs v1:\n> \n> Can you remind readers which thread was the v1?  Hopefully it is not\n> this one, right?\n> \n>   https://lore.kernel.org/git/20200322192234.GC671552@coredump.intra.peff.net/\n> \n> it concluded that it is not a great idea to set default filter with\n> \"--partial\", and the discussion led to a v2 with a reduced scope at\n> \n>   https://lore.kernel.org/git/pull.586.v2.git.1584906606469.gitgitgadget@gmail.com/\n> \n> and that one is already cooking.\n\nYes, sorry about that. I started working with Dyrone on this\nwhen my v1 was still being reviewed, so his commits are based\non that branch. Then when I force-pushed my branch his GGG PR\n\"grew\" with the old commits.\n\nThanks,\n-Stolee\n"},{"id":"395421","messageId":"xmqqimi29gqy.fsf@gitster.c.googlers.com","threadId":"53156","inReplyTo":"e77309ef-68a4-0ebd-0d82-051b07838fd5@gmail.com","subject":"Re: [PATCH v2 0/3] clone: document partial clone section","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-14T16:25:25Z","receivedAt":"2020-04-14T16:25:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Derrick Stolee <stolee@gmail.com> writes:\n\n> ... Then when I force-pushed my branch his GGG PR\n> \"grew\" with the old commits.\n\nAh, so we only need to review [3/3], treating it as a single patch\nseries?\n\nThanks.\n"},{"id":"395422","messageId":"3e3ef5ff-a808-efa0-ee32-9d24981efa0c@gmail.com","threadId":"53156","inReplyTo":"xmqqimi29gqy.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v2 0/3] clone: document partial clone section","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2020-04-14T16:26:52Z","receivedAt":"2020-04-14T16:27:51Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/14/2020 12:25 PM, Junio C Hamano wrote:\n> Derrick Stolee <stolee@gmail.com> writes:\n> \n>> ... Then when I force-pushed my branch his GGG PR\n>> \"grew\" with the old commits.\n> \n> Ah, so we only need to review [3/3], treating it as a single patch\n> series?\n\nCorrect. Thanks.\n\n-Stolee\n"},{"id":"408480","messageId":"pull.745.v3.git.git.1603768321361.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":"pull.745.v2.git.git.1586791560.gitgitgadget@gmail.com","subject":"[PATCH v3] clone: document partial clone section","fromName":"Teng Long via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-10-27T03:12:01Z","receivedAt":"2020-10-27T03:12:07Z","isPatch":true,"sender":{"key":"dyroneteng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7803958?v=4"},"body":"From: Dyrone Teng <dyroneteng@gmail.com>\n\nPartial clones are created using 'git clone', but there is no related\nhelp information in the git-clone documentation during a period. Add\na relevant section to help users understand what partial clones are\nand how they differ from normal clones.\n\nThe section briefly introduces the applicable scenarios and some\nprecautions of partial clone. If users want to know more about its\ntechnical design and other details, users can view the link of\ngit-partial-clone(7) according to the guidelines in the section.\n\nSigned-off-by: Teng Long <dyroneteng@gmail.com>\n---\n    clone: document partial clone section\n    \n    Partial clones are created using 'git clone', but there is no related\n    help information in the git-clone documentation during a period. Add a\n    relevant section to help users understand what partial clones are and\n    how they differ from normal clones.\n    \n    The section briefly introduces the applicable scenarios and some\n    precautions of partial clone. If users want to know more about its\n    technical design and other details, users can view the link of\n    git-partial-clone(7) according to the guidelines in the section.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v3\nPull-Request: https://github.com/git/git/pull/745\n\nRange-diff vs v2:\n\n 1:  6f340d9aad < -:  ---------- partial-clone: set default filter with --partial\n 2:  9baf4c8ba3 < -:  ---------- clone: document --partial and --filter options\n 3:  c1a44a3509 ! 1:  681c5dcb79 clone: document partial clone section\n     @@ Commit message\n          clone: document partial clone section\n      \n          Partial clones are created using 'git clone', but there is no related\n     -    help information in the git-clone documentation. Add a relevant section\n     -    to help users understand what partial clones are and how they differ\n     -    from normal clones.\n     +    help information in the git-clone documentation during a period. Add\n     +    a relevant section to help users understand what partial clones are\n     +    and how they differ from normal clones.\n      \n          The section briefly introduces the applicable scenarios and some\n          precautions of partial clone. If users want to know more about its\n          technical design and other details, users can view the link of\n          git-partial-clone(7) according to the guidelines in the section.\n      \n     -    Signed-off-by: Dyrone Teng <dyroneteng@gmail.com>\n     +    Signed-off-by: Teng Long <dyroneteng@gmail.com>\n      \n       ## Documentation/git-clone.txt ##\n      @@ Documentation/git-clone.txt: or `--mirror` is given)\n     @@ Documentation/git-clone.txt: or `--mirror` is given)\n      +-------------\n      +\n      +By default, `git clone` will download every reachable object, including\n     -+every version of every file in the history of the repository. The\n     -+**partial clone** feature allows Git to transfer fewer objects and\n     -+request them from the remote only when they are needed, so some\n     -+reachable objects can be omitted from the initial `git clone` and\n     -+subsequent `git fetch` operations.\n     ++every version of every file in the history of the repository. The **partial clone**\n     ++feature allows Git to transfer fewer objects and request them from the\n     ++remote only when they are needed, so some reachable objects can be\n     ++omitted from the initial `git clone` and subsequent `git fetch`\n     ++operations. In this way, a partial clone can reduce the network traffic\n     ++costs and disk space usage when git is working under a large repository.\n      +\n      +To use the partial clone feature, you can run `git clone` with the \n     -+`--filter=<filter-spec>` option. If you want to clone a repository\n     -+without download any blobs, the form `filter=blob:none` will omit all\n     -+the blobs. If the repository has some large blobs and you want to\n     -+prevent some large blobs being downloaded by an appropriate threshold,\n     -+the form `--filter=blob:limit=<n>[kmg]`omits blobs larger than n bytes\n     -+or units (see linkgit:git-rev-list[1]).\n     ++`--filter=<filter-spec>` option. If the repository has a deep history\n     ++and you don't want to download any blobs, the form `filter=blob:none`\n     ++will omit all the blobs. If the repository has some large blobs and you\n     ++want to prevent some large blobs being downloaded by an appropriate\n     ++threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n     ++than n bytes or units (see linkgit:git-rev-list[1]).\n      +\n     -+As mentioned before, a partially cloned repository may have to request\n     -+the missing objects when they are needed. So some 'local' commands may\n     -+fail without a network connection to the remote repository.\n     ++When using a partial clone, Git will request missing objects from the\n     ++remote(s) when necessary. Several commands that do not involve a request\n     ++over a network may now trigger these requests.\n      +\n      +For example, The <repository> contains two branches which names 'master'\n      +and 'topic. Then, we clone the repository by\n     @@ Documentation/git-clone.txt: or `--mirror` is given)\n      +were downloaded previously.\n      +\n      +`git log` may also make a surprise with partial clones. `git log\n     -+-- <pathspec>` will not cause downloads with the blob filters, because\n     -+it's only reading commits and trees. In addition to any options that\n     -+require git to look at the contents of blobs, like \"-p\" and \"--stat\"\n     -+, options that cause git to report pathnames, like \"--summary\" and\n     -+\"--raw\", will trigger lazy/on-demand fetching of blobs, as they are\n     -+needed to detect inexact renames.\n     -+\n     -+linkgit:partial-clone[1]\n     ++--<path>` will not cause downloads with the blob filters, because it's\n     ++only reading commits. `git log -p -- <path>` will download blobs to\n     ++generate the patch output and git log --raw will download all blobs\n     ++that changed at recent commits in order to compute renames.\n      +\n       :git-clone: 1\n       include::urls.txt[]\n\n\n Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex c898310099..15495675a8 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -308,6 +308,75 @@ or `--mirror` is given)\n \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n \tis only allowed if the directory is empty.\n \n+Partial Clone\n+-------------\n+\n+By default, `git clone` will download every reachable object, including\n+every version of every file in the history of the repository. The **partial clone**\n+feature allows Git to transfer fewer objects and request them from the\n+remote only when they are needed, so some reachable objects can be\n+omitted from the initial `git clone` and subsequent `git fetch`\n+operations. In this way, a partial clone can reduce the network traffic\n+costs and disk space usage when git is working under a large repository.\n+\n+To use the partial clone feature, you can run `git clone` with the \n+`--filter=<filter-spec>` option. If the repository has a deep history\n+and you don't want to download any blobs, the form `filter=blob:none`\n+will omit all the blobs. If the repository has some large blobs and you\n+want to prevent some large blobs being downloaded by an appropriate\n+threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n+than n bytes or units (see linkgit:git-rev-list[1]).\n+\n+When using a partial clone, Git will request missing objects from the\n+remote(s) when necessary. Several commands that do not involve a request\n+over a network may now trigger these requests.\n+\n+For example, The <repository> contains two branches which names 'master'\n+and 'topic. Then, we clone the repository by\n+\n+    $ git clone --filter=blob:none --no-checkout <repository>\n+\n+With the `--filter=blob:none` option Git will omit all the blobs and\n+the `--no-checkout` option Git will not perform a checkout of HEAD\n+after the clone is complete. Then, we check out the remote tracking\n+'topic' branch by\n+\n+    $ git checkout -b topic origin/topic \n+\n+The output looks like\n+\n+------------\n+    remote: Enumerating objects: 1, done.\n+    remote: Counting objects: 100% (1/1), done.\n+    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n+    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n+    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n+    Switched to a new branch 'topic'\n+------------\n+\n+The output is a bit surprising but it shows how partial clone works.\n+When we check out the branch 'topic' Git will request the missing blobs\n+because they are needed. Then, We can switch back to branch 'master' by\n+\n+    $ git checkout master\n+\n+This time the output looks like\n+\n+------------\n+    Switched to branch 'master'\n+    Your branch is up to date with 'origin/master'.\n+------------\n+\n+It shows that when we switch back to the previous location, the checkout\n+is done without a download because the repository has all the blobs that\n+were downloaded previously.\n+\n+`git log` may also make a surprise with partial clones. `git log\n+--<path>` will not cause downloads with the blob filters, because it's\n+only reading commits. `git log -p -- <path>` will download blobs to\n+generate the patch output and git log --raw will download all blobs\n+that changed at recent commits in order to compute renames.\n+\n :git-clone: 1\n include::urls.txt[]\n \n\nbase-commit: e1cfff676549cdcd702cbac105468723ef2722f4\n-- \ngitgitgadget\n"},{"id":"408507","messageId":"C9D6F2D9-7BA3-469D-B903-DB0B389C9166@gmail.com","threadId":"53156","inReplyTo":"pull.745.v3.git.git.1603768321361.gitgitgadget@gmail.com","subject":"Re: [PATCH v3] clone: document partial clone section","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2020-10-27T13:13:40Z","receivedAt":"2020-10-27T13:13:47Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Dyrone,\n\n> Le 26 oct. 2020 à 23:12, Teng Long via GitGitGadget <gitgitgadget@gmail.com> a écrit :\n> \n> From: Dyrone Teng <dyroneteng@gmail.com>\n> \n> Partial clones are created using 'git clone', but there is no related\n> help information in the git-clone documentation during a period. Add\n> a relevant section to help users understand what partial clones are\n> and how they differ from normal clones.\n> \n> The section briefly introduces the applicable scenarios and some\n> precautions of partial clone. If users want to know more about its\n> technical design and other details, users can view the link of\n> git-partial-clone(7) according to the guidelines in the section.\n> \n> Signed-off-by: Teng Long <dyroneteng@gmail.com>\n> ---\n>    clone: document partial clone section\n> \n>    Partial clones are created using 'git clone', but there is no related\n>    help information in the git-clone documentation during a period. Add a\n>    relevant section to help users understand what partial clones are and\n>    how they differ from normal clones.\n> \n>    The section briefly introduces the applicable scenarios and some\n>    precautions of partial clone. If users want to know more about its\n>    technical design and other details, users can view the link of\n>    git-partial-clone(7) according to the guidelines in the section.\n\nSince your series has just the one patch now, you don't need to add a description\nin your GitGitGadget (GGG) PR. That's why it appears two times here:\nthe text above the '---' is the commit message, and the text below is the PR description.\nIn the context of a one-patch series, you can use this space to add additional info that \ndo not fit into the commit message, for example questions about your patch, etc.\nIt is also a good idea (and viewed positively by reviewers) to use it to add a summary of what changed\nin your series since the last version you sent. I encourage you to read MyFirstContribution [1]\nfor a good tutorial on the contribution process. Also, GGG understands that if you end your\nPR description with a line starting with \"CC:\" and an email address, further iterations of your \nseries will be sent to those email addresses. So it would have been good to add Stolee in there, like this:\n\nCC: Derrick Stolee <stolee@gmail.com>\n\n(Junio prefers not to be directly CC'ed).\n\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v3\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v3\n> Pull-Request: https://github.com/git/git/pull/745\n> \n> Range-diff vs v2:\n> \n> 1:  6f340d9aad < -:  ---------- partial-clone: set default filter with --partial\n> 2:  9baf4c8ba3 < -:  ---------- clone: document --partial and --filter options\n> 3:  c1a44a3509 ! 1:  681c5dcb79 clone: document partial clone section\n>     @@ Commit message\n>          clone: document partial clone section\n> \n>          Partial clones are created using 'git clone', but there is no related\n>     -    help information in the git-clone documentation. Add a relevant section\n>     -    to help users understand what partial clones are and how they differ\n>     -    from normal clones.\n>     +    help information in the git-clone documentation during a period. Add\n>     +    a relevant section to help users understand what partial clones are\n>     +    and how they differ from normal clones.\n\nIt appears that you sent the same version of the patch as in v1, instead\nof the one you sent in v2 ? You had removed \"during a period\"  for v2, \nbut here it pops up again. You should check that you've sent the more \nup to date version of your patch, before sending v4.\n\nI will not comment on the patch below, since it's not the more up-to-date.\nI will send comments shortly on the v2 version by replying to [2] (the v2 version \nof your patch).\n\nCheers,\n\nPhilippe.\n\n[1] https://git-scm.com/docs/MyFirstContribution\n[2] https://lore.kernel.org/git/c1a44a35095e7d681c312ecaa07c46e49f2fae67.1586791560.git.gitgitgadget@gmail.com/"},{"id":"408508","messageId":"B90939A5-5693-4EB6-8F07-5B50F63B3143@gmail.com","threadId":"53156","inReplyTo":"c1a44a35095e7d681c312ecaa07c46e49f2fae67.1586791560.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 3/3] clone: document partial clone section","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2020-10-27T13:41:55Z","receivedAt":"2020-10-27T13:42:03Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Dyrone, \n\n> Le 13 avr. 2020 à 11:26, Dyrone Teng via GitGitGadget <gitgitgadget@gmail.com> a écrit :\n> \n> From: Dyrone Teng <dyroneteng@gmail.com>\n> \n> Partial clones are created using 'git clone', but there is no related\n> help information in the git-clone documentation. Add a relevant section\n> to help users understand what partial clones are and how they differ\n> from normal clones.\n> \n> The section briefly introduces the applicable scenarios and some\n> precautions of partial clone.\n\n\"some precautions users should take when using partial clone\" \nwould read better, I think.\n\n> If users want to know more about its\n> technical design and other details, users can view the link of\n> git-partial-clone(7) according to the guidelines in the section.\n\nNote: git-partial-clone(7) does not exist, i.e., there is document\nnamed 'gitpartial-clone.txt' in 'Documentation/ 'that is listed in the 'MAN7_TXT'\nvariable of the documentation Makefile. What exists is a document called\n'partial-clone.txt' in the 'technical' folder of the documentation.\nYou can do `git grep 'technical/' in 'Documentation/' to see how these pages\nare referred to in the rest of the documentation.\n\nAlso, the wording could be better:\n\n\"In case users want to know more about the technical design of the partial clone\nfeature, add a link to 'technical/partial-clone.txt'.\"\n\nwould be sufficient.\n\n> \n> Signed-off-by: Dyrone Teng <dyroneteng@gmail.com>\n> ---\n> Documentation/git-clone.txt | 72 +++++++++++++++++++++++++++++++++++++\n> 1 file changed, 72 insertions(+)\n> \n> diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\n> index eafa1c39927..a6e13666ea1 100644\n> --- a/Documentation/git-clone.txt\n> +++ b/Documentation/git-clone.txt\n> @@ -310,6 +310,78 @@ or `--mirror` is given)\n> \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n> \tis only allowed if the directory is empty.\n> \n> +Partial Clone\n> +-------------\n> +\n> +By default, `git clone` will download every reachable object, including\n> +every version of every file in the history of the repository. The\n> +**partial clone** feature allows Git to transfer fewer objects and\n> +request them from the remote only when they are needed, so some\n> +reachable objects can be omitted from the initial `git clone` and\n> +subsequent `git fetch` operations.\n> +\n> +To use the partial clone feature, you can run `git clone` with the \n> +`--filter=<filter-spec>` option. If you want to clone a repository\n> +without download\n\ns/download/downloading/\n\n> any blobs, the form `filter=blob:none` will omit all\n> +the blobs. If the repository has some large blobs and you want to\n> +prevent some large blobs being downloaded by an appropriate threshold,\n\nrepeating \"some large blobs\" two times here feels a little awkward. Maybe:\n\n\"If the repository has some large blobs and you want to prevent them from\nbeing downloaded\"\n\n> +the form `--filter=blob:limit=<n>[kmg]`omits blobs larger than n bytes\n> +or units (see linkgit:git-rev-list[1]).\n\nI think you could give an example here, and refer to git-rev-list[1] for the full syntax\n(also \"or units\" is a little unclear here). So maybe something like that:\n\n\"the form `--filter=blob:limit=1m` would prevent downloading objects bigger than 1 MiB \n(see the description of the `--filter=<filter-spec>` option in linkgit:git-rev-list[1] for the \nfull filter syntax)\".\n\n> +\n> +As mentioned before, a partially cloned repository may have to request\n> +the missing objects when they are needed. So some 'local' commands may\n> +fail without a network connection to the remote repository.\n> +\n> +For example, The <repository> contains two branches which names 'master'\n> +and 'topic. Then, we clone the repository by\n\nwording, and formatting:\n\nFor example, let's say a remote repository contains two branches named 'master'\nand 'topic'. We clone the repository with\n\n> +\n> +    $ git clone --filter=blob:none --no-checkout <repository>\n> +\n> +With the `--filter=blob:none` option Git will omit all the blobs and\n> +the `--no-checkout` option Git will not perform a checkout of HEAD\n\nsome punctuation would help:\n\nWith the  `--filter=blob:none` option, Git will omit all the blobs, and\nwith `--no-checkout`, Git will not checkout `HEAD`\n\n> +after the clone is complete. Then, we check out the remote tracking\n> +'topic' branch by\n\nHere you are not checking ou the remote-tracking 'topic' branch,\nyou are creating a local branch 'topic' that tracks the remote-tracking branch\n'origin/topic'.\n\n> +\n> +    $ git checkout -b topic origin/topic \n> +\n> +The output looks like\n> +\n> +------------\n> +    remote: Enumerating objects: 1, done.\n> +    remote: Counting objects: 100% (1/1), done.\n> +    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n> +    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n> +    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n> +    Switched to a new branch 'topic'\n> +------------\n> +\n> +The output is a bit surprising but it shows how partial clone works.\n> +When we check out the branch 'topic' Git will request the missing blobs\n> +because they are needed. Then, We\n\ns/We/we/\n\n> can switch back to branch 'master' by\n> +\n> +    $ git checkout master\n> +\n> +This time the output looks like\n> +\n> +------------\n> +    Switched to branch 'master'\n> +    Your branch is up to date with 'origin/master'.\n> +------------\n> +\n> +It shows that when we switch back to the previous location, the checkout\n> +is done without a download because the repository has all the blobs that\n> +were downloaded previously.\n> +\n> +`git log` may also make a surprise with partial clones.\n\n\"make a surprise\" reads awkward. \"have surprising behaviour\" would be better.\n\n> `git log\n> +-- <pathspec>` will not cause downloads with the blob filters,\n\nI think \"if the repository was cloned with `--filter=blob:none`\" would be clearer\nthan \"with the blob filters\".\n\n> because\n> +it's only reading commits and trees. In addition\n\n\"However, any options\" would be more appropriate than \"In addition to\" here.\n\n> to any options that\n> +require git\n\ns/git/Git/ (and the same thing below)\n\n> to look at the contents of blobs, like \"-p\" and \"--stat\"\n> +, options\n\nyou don't have to spell out \"options\" again here. And the options\nshould be enclosed in backticks instead of double quotes.\n\n> that cause git to report pathnames, like \"--summary\" and\n> +\"--raw\", will trigger lazy/on-demand fetching of blobs, as they are\n> +needed to detect inexact renames.\n> +\n> +linkgit:partial-clone[1]\n\nAgain, I'm pretty sure that does not work. You should build the documentation\nlocally and check that the links you are adding work. \"MyFirstContrbution\" \nhas pointer on how to do that.\n\n\nThank you for working on that ! \nIt's always great to see people wanting to improve the documentation.\n\nCheers,\n\nPhilippe.\n\n"},{"id":"408518","messageId":"xmqqft5zcxj3.fsf@gitster.c.googlers.com","threadId":"53156","inReplyTo":"C9D6F2D9-7BA3-469D-B903-DB0B389C9166@gmail.com","subject":"Re: [PATCH v3] clone: document partial clone section","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-27T18:51:44Z","receivedAt":"2020-10-27T18:51:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philippe Blain <levraiphilippeblain@gmail.com> writes:\n\n> Hi Dyrone,\n>\n>> Le 26 oct. 2020 à 23:12, Teng Long via GitGitGadget <gitgitgadget@gmail.com> a écrit :\n>> \n>> From: Dyrone Teng <dyroneteng@gmail.com>\n>> \n>> Partial clones are created using 'git clone', but there is no related\n>> help information in the git-clone documentation during a period. Add\n>> a relevant section to help users understand what partial clones are\n>> and how they differ from normal clones.\n>> \n>> The section briefly introduces the applicable scenarios and some\n>> precautions of partial clone. If users want to know more about its\n>> technical design and other details, users can view the link of\n>> git-partial-clone(7) according to the guidelines in the section.\n>> \n>> Signed-off-by: Teng Long <dyroneteng@gmail.com>\n\nCompare this line and \"From:\" we see above?\nThey need to match.\n\n>> ---\n>>    clone: document partial clone section\n>> \n>>    Partial clones are created using 'git clone', but there is no related\n>>    help information in the git-clone documentation during a period. Add a\n>>    relevant section to help users understand what partial clones are and\n>>    how they differ from normal clones.\n>> \n>>    The section briefly introduces the applicable scenarios and some\n>>    precautions of partial clone. If users want to know more about its\n>>    technical design and other details, users can view the link of\n>>    git-partial-clone(7) according to the guidelines in the section.\n>\n> Since your series has just the one patch now, you don't need to\n> add a description in your GitGitGadget (GGG) PR. That's why it\n> appears two times here: the text above the '---' is the commit\n> message, and the text below is the PR description.\n\nNice.  We learn new things every day---I've always wondered where\nthe duplicated description we sometimes see comes from.\n\n> In the context of a one-patch series, you can use this space to\n> add additional info that do not fit into the commit message, for\n> example questions about your patch, etc.  It is also a good idea\n> (and viewed positively by reviewers) to use it to add a summary of\n> what changed in your series since the last version you sent. I\n> encourage you to read MyFirstContribution [1] for a good tutorial\n> on the contribution process. Also, GGG understands that if you end\n> your PR description with a line starting with \"CC:\" and an email\n> address, further iterations of your series will be sent to those\n> email addresses. So it would have been good to add Stolee in\n> there, like this:\n>\n> CC: Derrick Stolee <stolee@gmail.com>\n\n> (Junio prefers not to be directly CC'ed).\n\n... unless it is the \"final version with concensus among reviewers\",\nthat is.\n\n>> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v3\n>> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v3\n>> Pull-Request: https://github.com/git/git/pull/745\n>> \n>> Range-diff vs v2:\n>> \n>> 1:  6f340d9aad < -:  ---------- partial-clone: set default filter with --partial\n>> 2:  9baf4c8ba3 < -:  ---------- clone: document --partial and --filter options\n>> 3:  c1a44a3509 ! 1:  681c5dcb79 clone: document partial clone section\n>>     @@ Commit message\n>>          clone: document partial clone section\n>> \n>>          Partial clones are created using 'git clone', but there is no related\n>>     -    help information in the git-clone documentation. Add a relevant section\n>>     -    to help users understand what partial clones are and how they differ\n>>     -    from normal clones.\n>>     +    help information in the git-clone documentation during a period. Add\n>>     +    a relevant section to help users understand what partial clones are\n>>     +    and how they differ from normal clones.\n>\n> It appears that you sent the same version of the patch as in v1, instead\n> of the one you sent in v2 ? You had removed \"during a period\"  for v2, \n> but here it pops up again. You should check that you've sent the more \n> up to date version of your patch, before sending v4.\n>\n> I will not comment on the patch below, since it's not the more up-to-date.\n> I will send comments shortly on the v2 version by replying to [2] (the v2 version \n> of your patch).\n>\n> Cheers,\n>\n> Philippe.\n>\n> [1] https://git-scm.com/docs/MyFirstContribution\n> [2] https://lore.kernel.org/git/c1a44a35095e7d681c312ecaa07c46e49f2fae67.1586791560.git.gitgitgadget@gmail.com/\n"},{"id":"417805","messageId":"pull.745.v4.git.git.1614244436547.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":"pull.745.v3.git.git.1603768321361.gitgitgadget@gmail.com","subject":"[PATCH v4] clone: document partial clone section","fromName":"Teng Long via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-02-25T09:13:56Z","receivedAt":"2021-02-25T09:17:38Z","isPatch":true,"sender":{"key":"dyroneteng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7803958?v=4"},"body":"From: Teng Long <dyroneteng@gmail.com>\n\nPartial clones are created using 'git clone', but there is no related\nhelp information in the git-clone documentation. Add a relevant section\nto help users understand what partial clones are and how they differ\nfrom normal clones.\n\nThe section briefly introduces the applicable scenarios and some\nprecautions of partial clone. If users want to know more about its\ntechnical design and other details, users can view the link of\ngit-partial-clone(7) according to the guidelines in the section.\n\nSigned-off-by: Teng Long <dyroneteng@gmail.com>\n---\n    clone: document partial clone section\n    \n    Partial clones are created using 'git clone', but there is no related\n    help information in the git-clone documentation during a period. Add a\n    relevant section to help users understand what partial clones are and\n    how they differ from normal clones.\n    \n    The section briefly introduces the applicable scenarios and some\n    precautions of partial clone. If users want to know more about its\n    technical design and other details, users can view the link of\n    git-partial-clone(7) according to the guidelines in the section.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v4\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v4\nPull-Request: https://github.com/git/git/pull/745\n\nRange-diff vs v3:\n\n 1:  681c5dcb7904 ! 1:  6d543cc11378 clone: document partial clone section\n     @@\n       ## Metadata ##\n     -Author: Dyrone Teng <dyroneteng@gmail.com>\n     +Author: Teng Long <dyroneteng@gmail.com>\n      \n       ## Commit message ##\n          clone: document partial clone section\n      \n          Partial clones are created using 'git clone', but there is no related\n     -    help information in the git-clone documentation during a period. Add\n     -    a relevant section to help users understand what partial clones are\n     -    and how they differ from normal clones.\n     +    help information in the git-clone documentation. Add a relevant section\n     +    to help users understand what partial clones are and how they differ\n     +    from normal clones.\n      \n          The section briefly introduces the applicable scenarios and some\n          precautions of partial clone. If users want to know more about its\n\n\n Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex c89831009989..15495675a8ce 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -308,6 +308,75 @@ or `--mirror` is given)\n \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n \tis only allowed if the directory is empty.\n \n+Partial Clone\n+-------------\n+\n+By default, `git clone` will download every reachable object, including\n+every version of every file in the history of the repository. The **partial clone**\n+feature allows Git to transfer fewer objects and request them from the\n+remote only when they are needed, so some reachable objects can be\n+omitted from the initial `git clone` and subsequent `git fetch`\n+operations. In this way, a partial clone can reduce the network traffic\n+costs and disk space usage when git is working under a large repository.\n+\n+To use the partial clone feature, you can run `git clone` with the \n+`--filter=<filter-spec>` option. If the repository has a deep history\n+and you don't want to download any blobs, the form `filter=blob:none`\n+will omit all the blobs. If the repository has some large blobs and you\n+want to prevent some large blobs being downloaded by an appropriate\n+threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n+than n bytes or units (see linkgit:git-rev-list[1]).\n+\n+When using a partial clone, Git will request missing objects from the\n+remote(s) when necessary. Several commands that do not involve a request\n+over a network may now trigger these requests.\n+\n+For example, The <repository> contains two branches which names 'master'\n+and 'topic. Then, we clone the repository by\n+\n+    $ git clone --filter=blob:none --no-checkout <repository>\n+\n+With the `--filter=blob:none` option Git will omit all the blobs and\n+the `--no-checkout` option Git will not perform a checkout of HEAD\n+after the clone is complete. Then, we check out the remote tracking\n+'topic' branch by\n+\n+    $ git checkout -b topic origin/topic \n+\n+The output looks like\n+\n+------------\n+    remote: Enumerating objects: 1, done.\n+    remote: Counting objects: 100% (1/1), done.\n+    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n+    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n+    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n+    Switched to a new branch 'topic'\n+------------\n+\n+The output is a bit surprising but it shows how partial clone works.\n+When we check out the branch 'topic' Git will request the missing blobs\n+because they are needed. Then, We can switch back to branch 'master' by\n+\n+    $ git checkout master\n+\n+This time the output looks like\n+\n+------------\n+    Switched to branch 'master'\n+    Your branch is up to date with 'origin/master'.\n+------------\n+\n+It shows that when we switch back to the previous location, the checkout\n+is done without a download because the repository has all the blobs that\n+were downloaded previously.\n+\n+`git log` may also make a surprise with partial clones. `git log\n+--<path>` will not cause downloads with the blob filters, because it's\n+only reading commits. `git log -p -- <path>` will download blobs to\n+generate the patch output and git log --raw will download all blobs\n+that changed at recent commits in order to compute renames.\n+\n :git-clone: 1\n include::urls.txt[]\n \n\nbase-commit: e1cfff676549cdcd702cbac105468723ef2722f4\n-- \ngitgitgadget\n"},{"id":"417815","messageId":"caf0fa50-6c2b-7764-1114-d933b2a06061@gmail.com","threadId":"53156","inReplyTo":"pull.745.v4.git.git.1614244436547.gitgitgadget@gmail.com","subject":"Re: [PATCH v4] clone: document partial clone section","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-02-25T13:38:57Z","receivedAt":"2021-02-25T13:39:53Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Dyrone,\n\nLe 2021-02-25 à 04:13, Teng Long via GitGitGadget a écrit :\n> From: Teng Long <dyroneteng@gmail.com>\n> \n> Partial clones are created using 'git clone', but there is no related\n> help information in the git-clone documentation. Add a relevant section\n> to help users understand what partial clones are and how they differ\n> from normal clones.\n> \n> The section briefly introduces the applicable scenarios and some\n> precautions of partial clone. If users want to know more about its\n> technical design and other details, users can view the link of\n> git-partial-clone(7) according to the guidelines in the section.\n> \n> Signed-off-by: Teng Long <dyroneteng@gmail.com>\n> ---\n>      clone: document partial clone section\n>      \n>      Partial clones are created using 'git clone', but there is no related\n>      help information in the git-clone documentation during a period. Add a\n>      relevant section to help users understand what partial clones are and\n>      how they differ from normal clones.\n>      \n>      The section briefly introduces the applicable scenarios and some\n>      precautions of partial clone. If users want to know more about its\n>      technical design and other details, users can view the link of\n>      git-partial-clone(7) according to the guidelines in the section.\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v4\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v4\n> Pull-Request: https://github.com/git/git/pull/745\n> \n> Range-diff vs v3:\n> \n>   1:  681c5dcb7904 ! 1:  6d543cc11378 clone: document partial clone section\n>       @@\n>         ## Metadata ##\n>       -Author: Dyrone Teng <dyroneteng@gmail.com>\n>       +Author: Teng Long <dyroneteng@gmail.com>\n>        \n>         ## Commit message ##\n>            clone: document partial clone section\n>        \n>            Partial clones are created using 'git clone', but there is no related\n>       -    help information in the git-clone documentation during a period. Add\n>       -    a relevant section to help users understand what partial clones are\n>       -    and how they differ from normal clones.\n>       +    help information in the git-clone documentation. Add a relevant section\n>       +    to help users understand what partial clones are and how they differ\n>       +    from normal clones.\n>        \n>            The section briefly introduces the applicable scenarios and some\n>            precautions of partial clone. If users want to know more about its\n\nThe \"range-diff\" above is automatically inserted by GitGitGadget and shows what has changed\nsince the last version you sent (i.e. it compares v3 to v4). So you adressed Junio's comment\nabout your commit identity and signed-off-by identity needing to match, good.\nYou also adressed my comment about the wording of the first paragraph of the commit message.\nBut then I wrote:\n\nHowever, you did not address all the feedback I sent as a reply to patch 3/3 of v2 (see [1]).\nSo it would be good to send a v5 with these suggestions incorporated (or, if you do not\nagree with a reviewer, you should still answer them and explain why).\n\nCheers,\n\nPhilippe.\n\n[1] https://lore.kernel.org/git/B90939A5-5693-4EB6-8F07-5B50F63B3143@gmail.com/\n"},{"id":"418105","messageId":"pull.745.v5.git.git.1614695133486.gitgitgadget@gmail.com","threadId":"53156","inReplyTo":"pull.745.v4.git.git.1614244436547.gitgitgadget@gmail.com","subject":"[PATCH v5] clone: document partial clone section","fromName":"Teng Long via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-03-02T14:25:32Z","receivedAt":"2021-03-02T15:28:37Z","isPatch":true,"sender":{"key":"dyroneteng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7803958?v=4"},"body":"From: Dyrone Teng <dyroneteng@gmail.com>\n\nPartial clones are created using 'git clone', but there is no related\nhelp information in the git-clone documentation during a period. Add\na relevant section to help users understand what partial clones are\nand how they differ from normal clones.\n\nThe section briefly introduces the applicable scenarios and some\nprecautions of partial clone. If users want to know more about its\ntechnical design and other details, users can view the link of\ngit-partial-clone(7) according to the guidelines in the section.\n\nSigned-off-by: Teng Long <dyroneteng@gmail.com>\n---\n    clone: document partial clone section\n    \n    cc: Philippe Blain levraiphilippeblain@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v5\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v5\nPull-Request: https://github.com/git/git/pull/745\n\nRange-diff vs v4:\n\n 1:  6d543cc11378 ! 1:  681c5dcb7904 clone: document partial clone section\n     @@\n       ## Metadata ##\n     -Author: Teng Long <dyroneteng@gmail.com>\n     +Author: Dyrone Teng <dyroneteng@gmail.com>\n      \n       ## Commit message ##\n          clone: document partial clone section\n      \n          Partial clones are created using 'git clone', but there is no related\n     -    help information in the git-clone documentation. Add a relevant section\n     -    to help users understand what partial clones are and how they differ\n     -    from normal clones.\n     +    help information in the git-clone documentation during a period. Add\n     +    a relevant section to help users understand what partial clones are\n     +    and how they differ from normal clones.\n      \n          The section briefly introduces the applicable scenarios and some\n          precautions of partial clone. If users want to know more about its\n\n\n Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex c89831009989..15495675a8ce 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -308,6 +308,75 @@ or `--mirror` is given)\n \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n \tis only allowed if the directory is empty.\n \n+Partial Clone\n+-------------\n+\n+By default, `git clone` will download every reachable object, including\n+every version of every file in the history of the repository. The **partial clone**\n+feature allows Git to transfer fewer objects and request them from the\n+remote only when they are needed, so some reachable objects can be\n+omitted from the initial `git clone` and subsequent `git fetch`\n+operations. In this way, a partial clone can reduce the network traffic\n+costs and disk space usage when git is working under a large repository.\n+\n+To use the partial clone feature, you can run `git clone` with the \n+`--filter=<filter-spec>` option. If the repository has a deep history\n+and you don't want to download any blobs, the form `filter=blob:none`\n+will omit all the blobs. If the repository has some large blobs and you\n+want to prevent some large blobs being downloaded by an appropriate\n+threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n+than n bytes or units (see linkgit:git-rev-list[1]).\n+\n+When using a partial clone, Git will request missing objects from the\n+remote(s) when necessary. Several commands that do not involve a request\n+over a network may now trigger these requests.\n+\n+For example, The <repository> contains two branches which names 'master'\n+and 'topic. Then, we clone the repository by\n+\n+    $ git clone --filter=blob:none --no-checkout <repository>\n+\n+With the `--filter=blob:none` option Git will omit all the blobs and\n+the `--no-checkout` option Git will not perform a checkout of HEAD\n+after the clone is complete. Then, we check out the remote tracking\n+'topic' branch by\n+\n+    $ git checkout -b topic origin/topic \n+\n+The output looks like\n+\n+------------\n+    remote: Enumerating objects: 1, done.\n+    remote: Counting objects: 100% (1/1), done.\n+    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n+    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n+    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n+    Switched to a new branch 'topic'\n+------------\n+\n+The output is a bit surprising but it shows how partial clone works.\n+When we check out the branch 'topic' Git will request the missing blobs\n+because they are needed. Then, We can switch back to branch 'master' by\n+\n+    $ git checkout master\n+\n+This time the output looks like\n+\n+------------\n+    Switched to branch 'master'\n+    Your branch is up to date with 'origin/master'.\n+------------\n+\n+It shows that when we switch back to the previous location, the checkout\n+is done without a download because the repository has all the blobs that\n+were downloaded previously.\n+\n+`git log` may also make a surprise with partial clones. `git log\n+--<path>` will not cause downloads with the blob filters, because it's\n+only reading commits. `git log -p -- <path>` will download blobs to\n+generate the patch output and git log --raw will download all blobs\n+that changed at recent commits in order to compute renames.\n+\n :git-clone: 1\n include::urls.txt[]\n \n\nbase-commit: e1cfff676549cdcd702cbac105468723ef2722f4\n-- \ngitgitgadget\n"},{"id":"418172","messageId":"xmqqeegwjazs.fsf@gitster.c.googlers.com","threadId":"53156","inReplyTo":"pull.745.v5.git.git.1614695133486.gitgitgadget@gmail.com","subject":"Re: [PATCH v5] clone: document partial clone section","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-03T19:25:11Z","receivedAt":"2021-03-04T00:23:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Teng Long via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Dyrone Teng <dyroneteng@gmail.com>\n>\n> Partial clones are created using 'git clone', but there is no related\n> help information in the git-clone documentation during a period. Add\n> a relevant section to help users understand what partial clones are\n> and how they differ from normal clones.\n>\n> The section briefly introduces the applicable scenarios and some\n> precautions of partial clone. If users want to know more about its\n> technical design and other details, users can view the link of\n> git-partial-clone(7) according to the guidelines in the section.\n>\n> Signed-off-by: Teng Long <dyroneteng@gmail.com>\n> ---\n>     clone: document partial clone section\n>     \n>     cc: Philippe Blain levraiphilippeblain@gmail.com\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-745%2Fdyrone%2Fmaster-v5\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-745/dyrone/master-v5\n> Pull-Request: https://github.com/git/git/pull/745\n\nPuzzlling.\n\nThis seems to be identical to v3.  Some \"rebase-i / push -f\"\naccident, or something?\n\n> Range-diff vs v4:\n>\n>  1:  6d543cc11378 ! 1:  681c5dcb7904 clone: document partial clone section\n>      @@\n>        ## Metadata ##\n>      -Author: Teng Long <dyroneteng@gmail.com>\n>      +Author: Dyrone Teng <dyroneteng@gmail.com>\n>       \n>        ## Commit message ##\n>           clone: document partial clone section\n>       \n>           Partial clones are created using 'git clone', but there is no related\n>      -    help information in the git-clone documentation. Add a relevant section\n>      -    to help users understand what partial clones are and how they differ\n>      -    from normal clones.\n>      +    help information in the git-clone documentation during a period. Add\n>      +    a relevant section to help users understand what partial clones are\n>      +    and how they differ from normal clones.\n>       \n>           The section briefly introduces the applicable scenarios and some\n>           precautions of partial clone. If users want to know more about its\n>\n>\n>  Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n>  1 file changed, 69 insertions(+)\n>\n> diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\n> index c89831009989..15495675a8ce 100644\n> --- a/Documentation/git-clone.txt\n> +++ b/Documentation/git-clone.txt\n> @@ -308,6 +308,75 @@ or `--mirror` is given)\n>  \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n>  \tis only allowed if the directory is empty.\n>  \n> +Partial Clone\n> +-------------\n> +\n> +By default, `git clone` will download every reachable object, including\n> +every version of every file in the history of the repository. The **partial clone**\n> +feature allows Git to transfer fewer objects and request them from the\n> +remote only when they are needed, so some reachable objects can be\n> +omitted from the initial `git clone` and subsequent `git fetch`\n> +operations. In this way, a partial clone can reduce the network traffic\n> +costs and disk space usage when git is working under a large repository.\n> +\n> +To use the partial clone feature, you can run `git clone` with the \n> +`--filter=<filter-spec>` option. If the repository has a deep history\n> +and you don't want to download any blobs, the form `filter=blob:none`\n> +will omit all the blobs. If the repository has some large blobs and you\n> +want to prevent some large blobs being downloaded by an appropriate\n> +threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n> +than n bytes or units (see linkgit:git-rev-list[1]).\n> +\n> +When using a partial clone, Git will request missing objects from the\n> +remote(s) when necessary. Several commands that do not involve a request\n> +over a network may now trigger these requests.\n> +\n> +For example, The <repository> contains two branches which names 'master'\n> +and 'topic. Then, we clone the repository by\n> +\n> +    $ git clone --filter=blob:none --no-checkout <repository>\n> +\n> +With the `--filter=blob:none` option Git will omit all the blobs and\n> +the `--no-checkout` option Git will not perform a checkout of HEAD\n> +after the clone is complete. Then, we check out the remote tracking\n> +'topic' branch by\n> +\n> +    $ git checkout -b topic origin/topic \n> +\n> +The output looks like\n> +\n> +------------\n> +    remote: Enumerating objects: 1, done.\n> +    remote: Counting objects: 100% (1/1), done.\n> +    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n> +    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n> +    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n> +    Switched to a new branch 'topic'\n> +------------\n> +\n> +The output is a bit surprising but it shows how partial clone works.\n> +When we check out the branch 'topic' Git will request the missing blobs\n> +because they are needed. Then, We can switch back to branch 'master' by\n> +\n> +    $ git checkout master\n> +\n> +This time the output looks like\n> +\n> +------------\n> +    Switched to branch 'master'\n> +    Your branch is up to date with 'origin/master'.\n> +------------\n> +\n> +It shows that when we switch back to the previous location, the checkout\n> +is done without a download because the repository has all the blobs that\n> +were downloaded previously.\n> +\n> +`git log` may also make a surprise with partial clones. `git log\n> +--<path>` will not cause downloads with the blob filters, because it's\n> +only reading commits. `git log -p -- <path>` will download blobs to\n> +generate the patch output and git log --raw will download all blobs\n> +that changed at recent commits in order to compute renames.\n> +\n>  :git-clone: 1\n>  include::urls.txt[]\n>  \n>\n> base-commit: e1cfff676549cdcd702cbac105468723ef2722f4\n"},{"id":"423746","messageId":"20210506062714.23191-1-dyroneteng@gmail.com","threadId":"53156","inReplyTo":"xmqqeegwjazs.fsf@gitster.c.googlers.com","subject":"Fix inconsistent signed-off-by abd author name","fromName":"Teng Long","fromEmail":"dyroneteng@gmail.com","sentAt":"2021-05-06T06:27:14Z","receivedAt":"2021-05-06T06:27:27Z","isPatch":false,"sender":{"key":"dyroneteng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7803958?v=4"},"body":"Teng Long (1):\n  clone: document partial clone section\n\n Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)\n\n-- \n2.31.1\n\n>Puzzlling.\n>\n>This seems to be identical to v3.  Some \"rebase-i / push -f\"\n>accident, or something?\n\nTo Junio:\n\nI confuse working and non-working user.name, fixed now in newest patch.\nThanks.\n"},{"id":"423747","messageId":"20210506063046.23353-1-dyroneteng@gmail.com","threadId":"53156","inReplyTo":"pull.745.v5.git.git.1614695133486.gitgitgadget@gmail.com","subject":"[PATCH 1/1] clone: document partial clone section","fromName":"Teng Long","fromEmail":"dyroneteng@gmail.com","sentAt":"2021-05-06T06:30:46Z","receivedAt":"2021-05-06T06:30:55Z","isPatch":true,"sender":{"key":"dyroneteng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7803958?v=4"},"body":"Partial clones are created using 'git clone', but there is no related\nhelp information in the git-clone documentation during a period. Add\na relevant section to help users understand what partial clones are\nand how they differ from normal clones.\n\nThe section briefly introduces the applicable scenarios and some\nprecautions of partial clone. If users want to know more about its\ntechnical design and other details, users can view the link of\ngit-partial-clone(7) according to the guidelines in the section.\n\nSigned-off-by: Teng Long <dyroneteng@gmail.com>\n---\n Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex c898310099..15495675a8 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -308,6 +308,75 @@ or `--mirror` is given)\n \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n \tis only allowed if the directory is empty.\n \n+Partial Clone\n+-------------\n+\n+By default, `git clone` will download every reachable object, including\n+every version of every file in the history of the repository. The **partial clone**\n+feature allows Git to transfer fewer objects and request them from the\n+remote only when they are needed, so some reachable objects can be\n+omitted from the initial `git clone` and subsequent `git fetch`\n+operations. In this way, a partial clone can reduce the network traffic\n+costs and disk space usage when git is working under a large repository.\n+\n+To use the partial clone feature, you can run `git clone` with the \n+`--filter=<filter-spec>` option. If the repository has a deep history\n+and you don't want to download any blobs, the form `filter=blob:none`\n+will omit all the blobs. If the repository has some large blobs and you\n+want to prevent some large blobs being downloaded by an appropriate\n+threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n+than n bytes or units (see linkgit:git-rev-list[1]).\n+\n+When using a partial clone, Git will request missing objects from the\n+remote(s) when necessary. Several commands that do not involve a request\n+over a network may now trigger these requests.\n+\n+For example, The <repository> contains two branches which names 'master'\n+and 'topic. Then, we clone the repository by\n+\n+    $ git clone --filter=blob:none --no-checkout <repository>\n+\n+With the `--filter=blob:none` option Git will omit all the blobs and\n+the `--no-checkout` option Git will not perform a checkout of HEAD\n+after the clone is complete. Then, we check out the remote tracking\n+'topic' branch by\n+\n+    $ git checkout -b topic origin/topic \n+\n+The output looks like\n+\n+------------\n+    remote: Enumerating objects: 1, done.\n+    remote: Counting objects: 100% (1/1), done.\n+    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n+    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n+    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n+    Switched to a new branch 'topic'\n+------------\n+\n+The output is a bit surprising but it shows how partial clone works.\n+When we check out the branch 'topic' Git will request the missing blobs\n+because they are needed. Then, We can switch back to branch 'master' by\n+\n+    $ git checkout master\n+\n+This time the output looks like\n+\n+------------\n+    Switched to branch 'master'\n+    Your branch is up to date with 'origin/master'.\n+------------\n+\n+It shows that when we switch back to the previous location, the checkout\n+is done without a download because the repository has all the blobs that\n+were downloaded previously.\n+\n+`git log` may also make a surprise with partial clones. `git log\n+--<path>` will not cause downloads with the blob filters, because it's\n+only reading commits. `git log -p -- <path>` will download blobs to\n+generate the patch output and git log --raw will download all blobs\n+that changed at recent commits in order to compute renames.\n+\n :git-clone: 1\n include::urls.txt[]\n \n-- \n2.31.1\n\n"},{"id":"423843","messageId":"dd4b4247-0981-4ad7-ce6f-448cedeeb4b0@gmail.com","threadId":"53156","inReplyTo":"20210506063046.23353-1-dyroneteng@gmail.com","subject":"Re: [PATCH 1/1] clone: document partial clone section","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-05-07T04:00:00Z","receivedAt":"2021-05-07T04:00:12Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 06/05/21 13.30, Teng Long wrote:\n> Partial clones are created using 'git clone', but there is no related\n> help information in the git-clone documentation during a period. Add\n> a relevant section to help users understand what partial clones are\n> and how they differ from normal clones.\n> \n> The section briefly introduces the applicable scenarios and some\n> precautions of partial clone. If users want to know more about its\n> technical design and other details, users can view the link of\n> git-partial-clone(7) according to the guidelines in the section.\n> \n> Signed-off-by: Teng Long <dyroneteng@gmail.com>\n> ---\n>   Documentation/git-clone.txt | 69 +++++++++++++++++++++++++++++++++++++\n>   1 file changed, 69 insertions(+)\n> \n> diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\n> index c898310099..15495675a8 100644\n> --- a/Documentation/git-clone.txt\n> +++ b/Documentation/git-clone.txt\n> @@ -308,6 +308,75 @@ or `--mirror` is given)\n>   \tfor `host.xz:foo/.git`).  Cloning into an existing directory\n>   \tis only allowed if the directory is empty.\n>   \n> +Partial Clone\n> +-------------\n> +\n> +By default, `git clone` will download every reachable object, including\n> +every version of every file in the history of the repository. The **partial clone**\n> +feature allows Git to transfer fewer objects and request them from the\n> +remote only when they are needed, so some reachable objects can be\n> +omitted from the initial `git clone` and subsequent `git fetch`\n> +operations. In this way, a partial clone can reduce the network traffic\n> +costs and disk space usage when git is working under a large repository.\n> +\n> +To use the partial clone feature, you can run `git clone` with the\n> +`--filter=<filter-spec>` option. If the repository has a deep history\n> +and you don't want to download any blobs, the form `filter=blob:none`\n> +will omit all the blobs. If the repository has some large blobs and you\n> +want to prevent some large blobs being downloaded by an appropriate\n> +threshold, the form `--filter=blob:limit=<n>[kmg]` omits blobs larger\n> +than n bytes or units (see linkgit:git-rev-list[1]).\n> +\nWhy not the following?:\n\n```\nIf the repository has some large blobs and you want to omit blobs larger\nthan desired size limit, use `--filter=blob:limit=<n>[kmg]`.\n```\n\n> +When using a partial clone, Git will request missing objects from the\n> +remote(s) when necessary. Several commands that do not involve a request\n> +over a network may now trigger these requests.\n> +\n> +For example, The <repository> contains two branches which names 'master'\n> +and 'topic. Then, we clone the repository by\n> +\n> +    $ git clone --filter=blob:none --no-checkout <repository>\n> +\n> +With the `--filter=blob:none` option Git will omit all the blobs and\n> +the `--no-checkout` option Git will not perform a checkout of HEAD\n> +after the clone is complete. Then, we check out the remote tracking\n> +'topic' branch by\n> +\n> +    $ git checkout -b topic origin/topic\n> +\n> +The output looks like\n> +\n> +------------\n> +    remote: Enumerating objects: 1, done.\n> +    remote: Counting objects: 100% (1/1), done.\n> +    remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\n> +    Receiving objects: 100% (1/1), 43 bytes | 43.00 KiB/s, done.\n> +    Branch 'topic' set up to track remote branch 'topic' from 'origin'.\n> +    Switched to a new branch 'topic'\n> +------------\n> +\n> +The output is a bit surprising but it shows how partial clone works.\n> +When we check out the branch 'topic' Git will request the missing blobs\n> +because they are needed. Then, We can switch back to branch 'master' by\n> +\n> +    $ git checkout master\n> +\n> +This time the output looks like\n> +\n> +------------\n> +    Switched to branch 'master'\n> +    Your branch is up to date with 'origin/master'.\n> +------------\n> +\n> +It shows that when we switch back to the previous location, the checkout\n> +is done without a download because the repository has all the blobs that\n> +were downloaded previously.\n> +\n> +`git log` may also make a surprise with partial clones. `git log\n> +--<path>` will not cause downloads with the blob filters, because it's\n> +only reading commits. `git log -p -- <path>` will download blobs to\n> +generate the patch output and git log --raw will download all blobs\n> +that changed at recent commits in order to compute renames.\n> +\n>   :git-clone: 1\n>   include::urls.txt[]\n>   \n> \n\nThis describes client-side usage. However, you missed the point that not\nall server supports partial clone. If you have your own Git server, and\nyou want to enable partial clone, you need to invoke as user running the\nserver daemon (typically `git`):\n\n`git config --global uploadpack.allowfilter true`\n\nAnd you also missed the case when someone wants to remove partial clone\nfilters (in order to turn into full clone), for example when needed to\npush to another repository as backup. See Gitlab docs for the instructions\n[1].\n\nHowever, brian m. carlson [CC'ed] suggested that \"fetch missing objects\"\nstep is instead be done using xargs to avoid \"Argument list too long\" error,\nsee [2].\n\n[1]: https://docs.gitlab.com/ee/topics/git/partial_clone.html#remove-partial-clone-filtering\n[2]: https://lore.kernel.org/git/YD7bczBsIR5rkqfc@camp.crustytoothpaste.net/\n-- \nAn old man doll... just what I always wanted! - Clara\n"}]}