{"thread":{"id":"53264","subject":"[PATCH 0/2] [WIP] removed fetch_if_missing global","startedAt":"2020-04-20T19:54:41Z","lastAt":"2023-02-22T18:19:18Z","messageCount":19,"participants":["Hariom Verma via GitGitGadget","Christian Couder","Junio C Hamano","Jonathan Tan","Hariom verma","Kousik Sanagavarapu"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"395755","messageId":"pull.606.git.1587412477.gitgitgadget@gmail.com","threadId":"53264","inReplyTo":null,"subject":"[PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Hariom Verma via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-20T19:54:35Z","receivedAt":"2020-04-20T19:54:41Z","isPatch":true,"sender":{"key":"name:Hariom Verma","avatar":null},"body":"We are not much happy with global variable fetch_if_missing. So, in commit\n6462d5eb9a (\"fetch: remove fetch_if_missing=0\", 2019-11-08) Jonathan Tan \njonathantanmy@google.com [jonathantanmy@google.com] attempted to remove the\nneed for fetch_if_missing=0 from the fetching mechanism. After that, \nfetch_if_missing is removed from clone and promisor-remote too.\n\nI imitated the same logic to remove fetch_if_missing from fetch-pack & \nindex-pack.\n\nI'm looking forward to remove fetch_if_missing from other places too, but I\nnot sure about how to handle it.\n\nIn fsck, fetch_if_missing is set to 0 in the beginning of cmd_fsck().\n\nIn rev-list, fetch_if_missing is set to 0 in parse_missing_action_value(),\nand in cmd_rev_list() while parsing the command-line parameters.(almost\nsimilar case in pack-objects)\n\nfixes #251\n\nHariom Verma (2):\n  fetch-pack: remove fetch_if_missing=0\n  index-pack: remove fetch_if_missing=0\n\n builtin/fetch-pack.c |  2 --\n builtin/index-pack.c | 11 ++---------\n fetch-pack.c         |  2 +-\n 3 files changed, 3 insertions(+), 12 deletions(-)\n\n\nbase-commit: be8661a3286c67a5d4088f4226cbd7f8b76544b0\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-606%2Fharry-hov%2Ffetch-if-missing-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-606/harry-hov/fetch-if-missing-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/606\n-- \ngitgitgadget\n"},{"id":"395756","messageId":"eb0cbeeeed080596c130f657186894999ae6121b.1587412477.git.gitgitgadget@gmail.com","threadId":"53264","inReplyTo":"pull.606.git.1587412477.gitgitgadget@gmail.com","subject":"[PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Hariom Verma via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-20T19:54:36Z","receivedAt":"2020-04-20T19:54:42Z","isPatch":true,"sender":{"key":"name:Hariom Verma","avatar":null},"body":"From: Hariom Verma <hariom18599@gmail.com>\n\nCommit 6462d5e (\"fetch: remove fetch_if_missing=0\", 2019-11-08)\nstrove to remove the need for fetch_if_missing=0 from the fetching\nmechanism, so it is plausible to attempt removing fetch_if_missing=0\nfrom fetch-pack as well.\n\nSigned-off-by: Hariom Verma <hariom18599@gmail.com>\n---\n builtin/fetch-pack.c | 2 --\n fetch-pack.c         | 2 +-\n 2 files changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex dc1485c8aa1..38a45512918 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -57,8 +57,6 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)\n \tstruct packet_reader reader;\n \tenum protocol_version version;\n \n-\tfetch_if_missing = 0;\n-\n \tpacket_trace_identity(\"fetch-pack\");\n \n \tmemset(&args, 0, sizeof(args));\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 1734a573b01..1ca643f6491 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1649,7 +1649,7 @@ static void update_shallow(struct fetch_pack_args *args,\n \t\tstruct oid_array extra = OID_ARRAY_INIT;\n \t\tstruct object_id *oid = si->shallow->oid;\n \t\tfor (i = 0; i < si->shallow->nr; i++)\n-\t\t\tif (has_object_file(&oid[i]))\n+\t\t\tif (has_object_file_with_flags(&oid[i], OBJECT_INFO_SKIP_FETCH_OBJECT))\n \t\t\t\toid_array_append(&extra, &oid[i]);\n \t\tif (extra.nr) {\n \t\t\tsetup_alternate_shallow(&shallow_lock,\n-- \ngitgitgadget\n\n"},{"id":"395757","messageId":"82f7473d3b8225771bbf09023ad2b5b787261dd0.1587412477.git.gitgitgadget@gmail.com","threadId":"53264","inReplyTo":"pull.606.git.1587412477.gitgitgadget@gmail.com","subject":"[PATCH 2/2] index-pack: remove fetch_if_missing=0","fromName":"Hariom Verma via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-20T19:54:37Z","receivedAt":"2020-04-20T19:54:45Z","isPatch":true,"sender":{"key":"name:Hariom Verma","avatar":null},"body":"From: Hariom Verma <hariom18599@gmail.com>\n\nCommit 6462d5e (\"fetch: remove fetch_if_missing=0\", 2019-11-08)\nstrove to remove the need for fetch_if_missing=0 from the fetching\nmechanism, so it is plausible to attempt removing fetch_if_missing=0\nfrom index-pack as well.\n\nSigned-off-by: Hariom Verma <hariom18599@gmail.com>\n---\n builtin/index-pack.c | 11 ++---------\n 1 file changed, 2 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex d967d188a30..9847baaf3f4 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -782,7 +782,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,\n \tif (startup_info->have_repository) {\n \t\tread_lock();\n \t\tcollision_test_needed =\n-\t\t\thas_object_file_with_flags(oid, OBJECT_INFO_QUICK);\n+\t\t\thas_object_file_with_flags(oid, OBJECT_INFO_QUICK | \n+\t\t\t\t\t\t\t\t\tOBJECT_INFO_SKIP_FETCH_OBJECT);\n \t\tread_unlock();\n \t}\n \n@@ -1673,14 +1674,6 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)\n \tunsigned foreign_nr = 1;\t/* zero is a \"good\" value, assume bad */\n \tint report_end_of_input = 0;\n \n-\t/*\n-\t * index-pack never needs to fetch missing objects except when\n-\t * REF_DELTA bases are missing (which are explicitly handled). It only\n-\t * accesses the repo to do hash collision checks and to check which\n-\t * REF_DELTA bases need to be fetched.\n-\t */\n-\tfetch_if_missing = 0;\n-\n \tif (argc == 2 && !strcmp(argv[1], \"-h\"))\n \t\tusage(index_pack_usage);\n \n-- \ngitgitgadget\n"},{"id":"397294","messageId":"CAP8UFD2SNnpKWtYUztZ76OU7zBsrXyYhG_Zds1wi+NqBKCv+Qw@mail.gmail.com","threadId":"53264","inReplyTo":"pull.606.git.1587412477.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2020-05-07T13:10:01Z","receivedAt":"2020-05-07T13:10:18Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Mon, Apr 20, 2020 at 9:57 PM Hariom Verma via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n>\n> We are not much happy with global variable fetch_if_missing. So, in commit\n> 6462d5eb9a (\"fetch: remove fetch_if_missing=0\", 2019-11-08) Jonathan Tan\n> jonathantanmy@google.com [jonathantanmy@google.com] attempted to remove the\n> need for fetch_if_missing=0 from the fetching mechanism. After that,\n> fetch_if_missing is removed from clone and promisor-remote too.\n\nYou might want to add Jonathan in Cc next time, as it could help your\npatches move forward. I have added him to this email.\n\n> I imitated the same logic to remove fetch_if_missing from fetch-pack &\n> index-pack.\n\nMaybe you could add a few tests as in 6462d5eb9a.\n\n> I'm looking forward to remove fetch_if_missing from other places too, but I\n> not sure about how to handle it.\n\nIt is ok to not take care of the other places for now. If that was the\nonly reason why this patch series is marked as WIP, then you might\nwant to remove WIP, especially if you add tests.\n\n> In fsck, fetch_if_missing is set to 0 in the beginning of cmd_fsck().\n>\n> In rev-list, fetch_if_missing is set to 0 in parse_missing_action_value(),\n> and in cmd_rev_list() while parsing the command-line parameters.(almost\n> similar case in pack-objects)\n>\n> fixes #251\n\nIt would be nice if you could give the full URL of the bug, as there\nhave been different bug trackers used by different people.\n\nThanks,\nChristian.\n"},{"id":"397295","messageId":"CAP8UFD2b_27VeLFg3BrbacoJ5+GAxa+JrF3E2jS_dN-xyCRP_Q@mail.gmail.com","threadId":"53264","inReplyTo":"eb0cbeeeed080596c130f657186894999ae6121b.1587412477.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2020-05-07T13:17:26Z","receivedAt":"2020-05-07T13:17:42Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Mon, Apr 20, 2020 at 9:57 PM Hariom Verma via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n>\n> From: Hariom Verma <hariom18599@gmail.com>\n>\n> Commit 6462d5e (\"fetch: remove fetch_if_missing=0\", 2019-11-08)\n> strove to remove the need for fetch_if_missing=0 from the fetching\n> mechanism, so it is plausible to attempt removing fetch_if_missing=0\n> from fetch-pack as well.\n\nIt's ok to refer to a previous commit, but I think it would be better\nif you could repeat a bit the reasons why removing the\nfetch_if_missing global is a good idea, and not just rely on the\nprevious commit.\n\n\"it is plausible\" also doesn't make it very clear that it's what the\npatch is actually doing.\n\nThanks,\nChristian.\n"},{"id":"397313","messageId":"xmqqmu6j4wlq.fsf@gitster.c.googlers.com","threadId":"53264","inReplyTo":"CAP8UFD2b_27VeLFg3BrbacoJ5+GAxa+JrF3E2jS_dN-xyCRP_Q@mail.gmail.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-07T15:02:09Z","receivedAt":"2020-05-07T15:02:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <christian.couder@gmail.com> writes:\n\n> On Mon, Apr 20, 2020 at 9:57 PM Hariom Verma via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n>>\n>> From: Hariom Verma <hariom18599@gmail.com>\n>>\n>> Commit 6462d5e (\"fetch: remove fetch_if_missing=0\", 2019-11-08)\n>> strove to remove the need for fetch_if_missing=0 from the fetching\n>> mechanism, so it is plausible to attempt removing fetch_if_missing=0\n>> from fetch-pack as well.\n>\n> It's ok to refer to a previous commit, but I think it would be better\n> if you could repeat a bit the reasons why removing the\n> fetch_if_missing global is a good idea, and not just rely on the\n> previous commit.\n>\n> \"it is plausible\" also doesn't make it very clear that it's what the\n> patch is actually doing.\n\nI had the same reaction.  You could even write a random gibberish in\nyour patch and write \"it's plausible this set of random changes made\nwithout understanding what is going on in the current code might\nhave some chance to work\" in your log message, and we would not even\nwant to touch such a patch with 10-foot pole.\n\nThe proposed log message above unfortunately makes this patch\nindistinguishable from such a trash, unless we follow the codepaths\nthat are *not* touched by this patch and think about ramifications\nof the removal *ourselves*.  In other words, it does nothing to help\nthe readers to support the change.\n\n"},{"id":"397341","messageId":"20200507194354.33347-1-jonathantanmy@google.com","threadId":"53264","inReplyTo":"eb0cbeeeed080596c130f657186894999ae6121b.1587412477.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2020-05-07T19:43:54Z","receivedAt":"2020-05-07T19:44:00Z","isPatch":true,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"> From: Hariom Verma <hariom18599@gmail.com>\n> \n> Commit 6462d5e (\"fetch: remove fetch_if_missing=0\", 2019-11-08)\n> strove to remove the need for fetch_if_missing=0 from the fetching\n> mechanism, so it is plausible to attempt removing fetch_if_missing=0\n> from fetch-pack as well.\n> \n> Signed-off-by: Hariom Verma <hariom18599@gmail.com>\n\nAs Christian said [1], please include tests like in the commit you\nmentioned. For a change like this, I think that the test is the most\nimportant part.\n\nAlso include a justification for why it's safe to remove\nfetch_if_missing=0. You can probably cite the aforementioned commit to\nsay that it covers the fetch_pack() method, and then go through the rest\nof the code to see if any may inadvertently fetch an object.\n\nAlso, the fetch-pack and index-pack parts can be sent in separate patch\nsets, so you might want to concentrate on one command first.\n\n[1] https://lore.kernel.org/git/CAP8UFD2SNnpKWtYUztZ76OU7zBsrXyYhG_Zds1wi+NqBKCv+Qw@mail.gmail.com/\n\n> diff --git a/fetch-pack.c b/fetch-pack.c\n> index 1734a573b01..1ca643f6491 100644\n> --- a/fetch-pack.c\n> +++ b/fetch-pack.c\n> @@ -1649,7 +1649,7 @@ static void update_shallow(struct fetch_pack_args *args,\n>  \t\tstruct oid_array extra = OID_ARRAY_INIT;\n>  \t\tstruct object_id *oid = si->shallow->oid;\n>  \t\tfor (i = 0; i < si->shallow->nr; i++)\n> -\t\t\tif (has_object_file(&oid[i]))\n> +\t\t\tif (has_object_file_with_flags(&oid[i], OBJECT_INFO_SKIP_FETCH_OBJECT))\n>  \t\t\t\toid_array_append(&extra, &oid[i]);\n>  \t\tif (extra.nr) {\n>  \t\t\tsetup_alternate_shallow(&shallow_lock,\n\nHmm...this triggers when the user requests a clone that is both partial\nand shallow, and the server reports a shallow object that it didn't send\nback as a packfile; and it causes another fetch to be sent. This is a\nseparate issue, but Hariom, if you'd like to take a look at this, that\nwould work out too. You'll need to figure out how to make the server\nsend back shallow lines referencing objects that are not in the packfile\n- one way to do it is to use one-time-perl. (Search the codebase to see\nhow it is used.) This is probably more complex, though.\n"},{"id":"397462","messageId":"CA+CkUQ8z=ZFFwGA_Xz=40HqVcjntZbGzDXFthxMF8XrEhxMY2A@mail.gmail.com","threadId":"53264","inReplyTo":"CAP8UFD2SNnpKWtYUztZ76OU7zBsrXyYhG_Zds1wi+NqBKCv+Qw@mail.gmail.com","subject":"Re: [PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Hariom verma","fromEmail":"hariom18599@gmail.com","sentAt":"2020-05-09T17:35:20Z","receivedAt":"2020-05-09T17:35:33Z","isPatch":true,"sender":{"key":"hariom18599@gmail.com","avatar":"https://avatars.githubusercontent.com/u/37576387?v=4"},"body":"On Thu, May 7, 2020 at 6:40 PM Christian Couder\n<christian.couder@gmail.com> wrote:\n>\n> You might want to add Jonathan in Cc next time, as it could help your\n> patches move forward. I have added him to this email.\n\nThanks, I'll remember next time.\n\n> Maybe you could add a few tests as in 6462d5eb9a.\n\nSounds like a plan.\n\n> It is ok to not take care of the other places for now. If that was the\n> only reason why this patch series is marked as WIP, then you might\n> want to remove WIP, especially if you add tests.\n\nI'll remove it, after writing tests.\n\n> It would be nice if you could give the full URL of the bug, as there\n> have been different bug trackers used by different people.\n\nI'll do this in future versions.\n\nThanks,\nHariom\n\nOn Thu, May 7, 2020 at 6:40 PM Christian Couder\n<christian.couder@gmail.com> wrote:\n>\n> On Mon, Apr 20, 2020 at 9:57 PM Hariom Verma via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n> >\n> > We are not much happy with global variable fetch_if_missing. So, in commit\n> > 6462d5eb9a (\"fetch: remove fetch_if_missing=0\", 2019-11-08) Jonathan Tan\n> > jonathantanmy@google.com [jonathantanmy@google.com] attempted to remove the\n> > need for fetch_if_missing=0 from the fetching mechanism. After that,\n> > fetch_if_missing is removed from clone and promisor-remote too.\n>\n> You might want to add Jonathan in Cc next time, as it could help your\n> patches move forward. I have added him to this email.\n>\n> > I imitated the same logic to remove fetch_if_missing from fetch-pack &\n> > index-pack.\n>\n> Maybe you could add a few tests as in 6462d5eb9a.\n>\n> > I'm looking forward to remove fetch_if_missing from other places too, but I\n> > not sure about how to handle it.\n>\n> It is ok to not take care of the other places for now. If that was the\n> only reason why this patch series is marked as WIP, then you might\n> want to remove WIP, especially if you add tests.\n>\n> > In fsck, fetch_if_missing is set to 0 in the beginning of cmd_fsck().\n> >\n> > In rev-list, fetch_if_missing is set to 0 in parse_missing_action_value(),\n> > and in cmd_rev_list() while parsing the command-line parameters.(almost\n> > similar case in pack-objects)\n> >\n> > fixes #251\n>\n> It would be nice if you could give the full URL of the bug, as there\n> have been different bug trackers used by different people.\n>\n> Thanks,\n> Christian.\n"},{"id":"397463","messageId":"CA+CkUQ8WYd+sR6cBKxK73SJZR-yFnea6Gz+pNABSso44Sgv6Pg@mail.gmail.com","threadId":"53264","inReplyTo":"CAP8UFD2b_27VeLFg3BrbacoJ5+GAxa+JrF3E2jS_dN-xyCRP_Q@mail.gmail.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Hariom verma","fromEmail":"hariom18599@gmail.com","sentAt":"2020-05-09T17:40:47Z","receivedAt":"2020-05-09T17:41:02Z","isPatch":true,"sender":{"key":"hariom18599@gmail.com","avatar":"https://avatars.githubusercontent.com/u/37576387?v=4"},"body":"On Thu, May 7, 2020 at 6:47 PM Christian Couder\n<christian.couder@gmail.com> wrote:\n>\n> It's ok to refer to a previous commit, but I think it would be better\n> if you could repeat a bit the reasons why removing the\n> fetch_if_missing global is a good idea, and not just rely on the\n> previous commit.\n\nI agree with that.\n\n> \"it is plausible\" also doesn't make it very clear that it's what the\n> patch is actually doing.\n\nThanks for pointing it out. Will improve.\n\nRegards,\nHariom\n"},{"id":"397464","messageId":"CA+CkUQ-5UObKvsZK1y0YPo4Aii0f4ELFnk8Fw6EN4A+TL3GbZQ@mail.gmail.com","threadId":"53264","inReplyTo":"xmqqmu6j4wlq.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Hariom verma","fromEmail":"hariom18599@gmail.com","sentAt":"2020-05-09T17:48:08Z","receivedAt":"2020-05-09T17:48:23Z","isPatch":true,"sender":{"key":"hariom18599@gmail.com","avatar":"https://avatars.githubusercontent.com/u/37576387?v=4"},"body":"On Thu, May 7, 2020 at 8:32 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Christian Couder <christian.couder@gmail.com> writes:\n>\n> > It's ok to refer to a previous commit, but I think it would be better\n> > if you could repeat a bit the reasons why removing the\n> > fetch_if_missing global is a good idea, and not just rely on the\n> > previous commit.\n> >\n> > \"it is plausible\" also doesn't make it very clear that it's what the\n> > patch is actually doing.\n>\n> I had the same reaction.  You could even write a random gibberish in\n> your patch and write \"it's plausible this set of random changes made\n> without understanding what is going on in the current code might\n> have some chance to work\" in your log message, and we would not even\n> want to touch such a patch with 10-foot pole.\n>\n> The proposed log message above unfortunately makes this patch\n> indistinguishable from such a trash, unless we follow the codepaths\n> that are *not* touched by this patch and think about ramifications\n> of the removal *ourselves*.  In other words, it does nothing to help\n> the readers to support the change.\n>\n\nI understand it must be too hard for you to deal with such [trash]patches.\nMy apologies. Will improve in next revision\n\nThanks,\nHariom\n"},{"id":"397465","messageId":"CA+CkUQ8fa=osCunE2Nj1ezzci_qEkv7mRwX=9Cg-kkMYcDHx=w@mail.gmail.com","threadId":"53264","inReplyTo":"20200507194354.33347-1-jonathantanmy@google.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Hariom verma","fromEmail":"hariom18599@gmail.com","sentAt":"2020-05-09T18:00:28Z","receivedAt":"2020-05-09T18:00:42Z","isPatch":true,"sender":{"key":"hariom18599@gmail.com","avatar":"https://avatars.githubusercontent.com/u/37576387?v=4"},"body":"On Fri, May 8, 2020 at 1:13 AM Jonathan Tan <jonathantanmy@google.com> wrote:\n>\n> As Christian said [1], please include tests like in the commit you\n> mentioned. For a change like this, I think that the test is the most\n> important part.\n>\n\nI will definitely add tests.\n\n> Also include a justification for why it's safe to remove\n> fetch_if_missing=0. You can probably cite the aforementioned commit to\n> say that it covers the fetch_pack() method, and then go through the rest\n> of the code to see if any may inadvertently fetch an object.\n>\n> Also, the fetch-pack and index-pack parts can be sent in separate patch\n> sets, so you might want to concentrate on one command first.\n>\n\nThanks, Will split and concentrate on one at a time.\n\n>\n> > diff --git a/fetch-pack.c b/fetch-pack.c\n> > index 1734a573b01..1ca643f6491 100644\n> > --- a/fetch-pack.c\n> > +++ b/fetch-pack.c\n> > @@ -1649,7 +1649,7 @@ static void update_shallow(struct fetch_pack_args *args,\n> >               struct oid_array extra = OID_ARRAY_INIT;\n> >               struct object_id *oid = si->shallow->oid;\n> >               for (i = 0; i < si->shallow->nr; i++)\n> > -                     if (has_object_file(&oid[i]))\n> > +                     if (has_object_file_with_flags(&oid[i], OBJECT_INFO_SKIP_FETCH_OBJECT))\n> >                               oid_array_append(&extra, &oid[i]);\n> >               if (extra.nr) {\n> >                       setup_alternate_shallow(&shallow_lock,\n>\n> Hmm...this triggers when the user requests a clone that is both partial\n> and shallow, and the server reports a shallow object that it didn't send\n> back as a packfile; and it causes another fetch to be sent. This is a\n> separate issue, but Hariom, if you'd like to take a look at this, that\n> would work out too. You'll need to figure out how to make the server\n> send back shallow lines referencing objects that are not in the packfile\n> - one way to do it is to use one-time-perl. (Search the codebase to see\n> how it is used.) This is probably more complex, though.\n\nI'm clueless about \"one-time-perl\" thing(till now!). Will surely going\nto learn about that.\n\nThanks for the nice explanation.\n\nRegards,\nHariom\n"},{"id":"472257","messageId":"20230217172035.79864-1-five231003@gmail.com","threadId":"53264","inReplyTo":"pull.606.git.1587412477.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Kousik Sanagavarapu","fromEmail":"five231003@gmail.com","sentAt":"2023-02-17T17:20:35Z","receivedAt":"2023-02-17T17:20:42Z","isPatch":true,"sender":{"key":"five231003@gmail.com","avatar":"https://avatars.githubusercontent.com/u/75560439?v=4"},"body":"Hi,\n\nAre you still working on this? If not, then I would like to take this up\nand write the tests, if it is worth doing. I think it would be a better\nexposure of the codebase and would be helpful for GSoC.\n"},{"id":"472303","messageId":"CAP8UFD1k4S-J0UXiFS9mdn_TqGc2kb3iaVYUP2ektrJ+uJZMWw@mail.gmail.com","threadId":"53264","inReplyTo":"20230217172035.79864-1-five231003@gmail.com","subject":"Re: [PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2023-02-18T17:00:03Z","receivedAt":"2023-02-18T17:00:18Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi Kousik,\n\nOn Fri, Feb 17, 2023 at 7:22 PM Kousik Sanagavarapu\n<five231003@gmail.com> wrote:\n\n> Are you still working on this? If not, then I would like to take this up\n> and write the tests, if it is worth doing. I think it would be a better\n> exposure of the codebase and would be helpful for GSoC.\n\nI don't know what's the state of this. I think only Hariom could answer.\n\nI am not so sure it will be helpful for any of the GSoC project ideas\nwe propose, but feel free to work on it if you want.\n\nThanks,\nChristian.\n"},{"id":"472311","messageId":"20230219035724.99907-1-five231003@gmail.com","threadId":"53264","inReplyTo":"CAP8UFD1k4S-J0UXiFS9mdn_TqGc2kb3iaVYUP2ektrJ+uJZMWw@mail.gmail.com","subject":"Re: [PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Kousik Sanagavarapu","fromEmail":"five231003@gmail.com","sentAt":"2023-02-19T03:57:24Z","receivedAt":"2023-02-19T03:57:37Z","isPatch":true,"sender":{"key":"five231003@gmail.com","avatar":"https://avatars.githubusercontent.com/u/75560439?v=4"},"body":"On Sat, 18 Feb 2023 at 22:30, Christian Couder\n<christian.couder@gmail.com> wrote:\n\n>\n> I am not so sure it will be helpful for any of the GSoC project ideas\n> we propose, but feel free to work on it if you want.\n\nWell, I wanted to work on something before I started working on my application\nand found this to be fun. So even if it would not really be\nhelpful for the project ideas proposed, I would still like to work on it as\nsomething that could go into my application.\n\nThanks,\nKousik\n"},{"id":"472312","messageId":"CAP8UFD3TywqERjb7NjUXCqgherojnKcD5NDy9T_RE2Ldubd2hQ@mail.gmail.com","threadId":"53264","inReplyTo":"20230219035724.99907-1-five231003@gmail.com","subject":"Re: [PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2023-02-19T07:37:57Z","receivedAt":"2023-02-19T07:38:12Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Feb 19, 2023 at 4:57 AM Kousik Sanagavarapu\n<five231003@gmail.com> wrote:\n>\n> On Sat, 18 Feb 2023 at 22:30, Christian Couder\n> <christian.couder@gmail.com> wrote:\n>\n> > I am not so sure it will be helpful for any of the GSoC project ideas\n> > we propose, but feel free to work on it if you want.\n>\n> Well, I wanted to work on something before I started working on my application\n> and found this to be fun. So even if it would not really be\n> helpful for the project ideas proposed, I would still like to work on it as\n> something that could go into my application.\n\nSure, you can mention anything you did related to the project in your\napplication and we will take it into account.\n\nThanks,\nChristian.\n"},{"id":"472313","messageId":"CA+CkUQ9AMFc9DHE1tknJvX_XhuezoWvWFSXw97FLwdGHVGXWHw@mail.gmail.com","threadId":"53264","inReplyTo":"20230217172035.79864-1-five231003@gmail.com","subject":"Re: [PATCH 0/2] [WIP] removed fetch_if_missing global","fromName":"Hariom verma","fromEmail":"hariom18599@gmail.com","sentAt":"2023-02-19T10:40:09Z","receivedAt":"2023-02-19T10:40:25Z","isPatch":true,"sender":{"key":"hariom18599@gmail.com","avatar":"https://avatars.githubusercontent.com/u/37576387?v=4"},"body":"HI,\n\nOn Fri, Feb 17, 2023 at 10:50 PM Kousik Sanagavarapu\n<five231003@gmail.com> wrote:\n>\n> Are you still working on this? If not, then I would like to take this up\n> and write the tests, if it is worth doing. I think it would be a better\n> exposure of the codebase and would be helpful for GSoC.\n\nI'm not working on it. Feel free to take it forward.\n\nThanks,\nHariom\n"},{"id":"472349","messageId":"20230220181324.25116-1-five231003@gmail.com","threadId":"53264","inReplyTo":"20200507194354.33347-1-jonathantanmy@google.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Kousik Sanagavarapu","fromEmail":"five231003@gmail.com","sentAt":"2023-02-20T18:13:24Z","receivedAt":"2023-02-20T18:13:39Z","isPatch":true,"sender":{"key":"five231003@gmail.com","avatar":"https://avatars.githubusercontent.com/u/75560439?v=4"},"body":"So here, we are partial-cloning from a shallow remote and some\nobjects are not sent due to our clone filters. Let's say that\nthe shallow remote has a 5-commit history and we are cloning it\ninto another repository with a blob:none filter. The expected\nbehavior is cloning the 5 commits, with no blobs, except\nfor the HEAD.\n\nWhen executing the above process, it leads to errors:\n\n\tfatal: the remote end hung up unexpectedly\n\tfatal: protocol error: bad pack header\n\twarning: Clone succeeded, but checkout failed\n\tYou can inspect what was checked out with 'git status'\n\tand retry with 'git restore --source=HEAD :/'\n\nI looked into it a bit and it seems that packet_read() is not\nsuccessful. I'm not really sure how packet reading fits into\nthe big picture but it looks like the buffer is not read\ncompletely.\n\nIt is a similar case with \"bad pack header\" too. The function\nread_pack_header() fails because the pack header was not fully read.\n\nAlso, is the shallow object not sent when cloning due to the partial\nclone filter and hence a subsequent fetching is done to ask for this\nobject? If so, then will such a fetch counted as an args->update_shallow?\n"},{"id":"472449","messageId":"20230222174520.21795-1-five231003@gmail.com","threadId":"53264","inReplyTo":"20200507194354.33347-1-jonathantanmy@google.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Kousik Sanagavarapu","fromEmail":"five231003@gmail.com","sentAt":"2023-02-22T17:45:20Z","receivedAt":"2023-02-22T17:45:41Z","isPatch":true,"sender":{"key":"five231003@gmail.com","avatar":"https://avatars.githubusercontent.com/u/75560439?v=4"},"body":"Sorry, it seems that I misunderstood the whole situation here. I didn't\nrealize that the problem was on my end and not something to do with the\ncode. Please ignore the above email except for the last question, which\nI still don't seem to understand. So, I would be grateful if you could\nclarify.\n\nThanks,\nKousik\n"},{"id":"472450","messageId":"20230222181908.1177403-1-jonathantanmy@google.com","threadId":"53264","inReplyTo":"20230220181324.25116-1-five231003@gmail.com","subject":"Re: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2023-02-22T18:19:08Z","receivedAt":"2023-02-22T18:19:18Z","isPatch":true,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"Kousik Sanagavarapu <five231003@gmail.com> writes:\n> Also, is the shallow object not sent when cloning due to the partial\n> clone filter and hence a subsequent fetching is done to ask for this\n> object? If so, then will such a fetch counted as an args->update_shallow?\n\nWhat do you mean by the shallow object? If you mean the last commit that\nis sent (that is, without its parents), then that is a commit and is not\nexcluded by the filter.\n\nAs for args->update_shallow, that's a good question. Just glancing at\nthe code, even if it is set, I don't think there would be any difference\nin operation since the lazy fetch does not fetch any refs (and in fact,\nin protocol v2, we skip the ref advertisement in this case, as far as I\ncan remember).\n"}]}