From: Derrick Stolee Date: Mon, 12 Apr 2021 20:23:51 GMT Subject: Re: [PATCH v3 2/3] fetch: add --prefetch option Message-ID: <28857e57-d9c6-ecb9-8a7d-d85a29f20f33@gmail.com> In-Reply-To: <9e009c7e-a2bf-1740-ba43-c64a97f1dc28@ramsayjones.plus.com> On 4/11/21 5:09 PM, Ramsay Jones wrote:> On 10/04/2021 03:03, Derrick Stolee via GitGitGadget wrote: >> From: Derrick Stolee >> + for (i = 0; i < rs->nr; i++) { >> + struct strbuf new_dst = STRBUF_INIT; >> + char *old_dst; >> + const char *sub = NULL; >> + >> + if (rs->items[i].negative) >> + continue; >> + if (!rs->items[i].dst || >> + (rs->items[i].src && >> + !strncmp(rs->items[i].src, "refs/tags/", 10))) { >> + int j; >> + >> + free(rs->items[i].src); >> + free(rs->items[i].dst); >> + >> + for (j = i + 1; j < rs->nr; j++) { >> + rs->items[j - 1] = rs->items[j]; >> + rs->raw[j - 1] = rs->raw[j]; >> + } >> + rs->nr--; > > Hmm, don't you need to do 'i--;' here? > > (Sorry in advance if this is nonsense, I am just skimming the > patches without reading the whole series carefully). > > Maybe try a test which has an entry, which requires the 'prefetch' > modification, that immediately follows a 'tag' or 'empty dst' entry. > (I can't quite tell, just reading the email, whether that is covered > by the tests below - so please just ignore me if it already works ;) You are absolutely right! Thanks. -Stolee