{"thread":{"id":"66544","subject":"[PATCH] refs: fix loose-ref seeking across directory boundaries","startedAt":"2026-10-15T12:30:55Z","lastAt":"2026-10-28T16:26:34Z","messageCount":11,"participants":["Venkat Ragavan via GitGitGadget","Harald Nordgren","D. Ben Knoble","Junio C Hamano","Venkat Ragavan","Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"555139","messageId":"pull.2258.git.1792067455341.gitgitgadget@gmail.com","threadId":"66544","inReplyTo":null,"subject":"[PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Venkat Ragavan via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-15T12:30:55Z","receivedAt":"2026-10-15T12:30:55Z","isPatch":true,"sender":{"key":"name:Venkat Ragavan","avatar":null},"body":"From: Venkat Ragavan S <mail2venkat21@gmail.com>\n\nWhen seeking through loose refs, cache_ref_iterator_seek() compares\neach directory component without its trailing slash. This can confuse\na directory with a similarly named ref that sorts before it.\n\nFor example, with these refs:\n\n    refs/tags/releases-z\n    refs/tags/releases/v1\n    refs/tags/releases/v2\n\nStarting after refs/tags/releases/v1 can position the iterator at\nreleases-z instead of descending into releases/. Iteration then\nreturns v1 again, even though it should return only v2.\n\nInclude the trailing slash when comparing directory components so\nthat the seek follows the correct directory.\n\nAlso handle two related positioning errors. If every entry in a\ndirectory precedes the cursor, stop searching that level rather than\ndescending into its last entry. If a leaf sorts after the cursor,\nleave the iterator positioned to return it, even when the cursor has\nremaining path components.\n\nAdd regression tests for shared-prefix names, missing nested markers,\nand markers beyond the end of the ref listing, using loose, packed,\nand mixed refs.\n\nSigned-off-by: Venkat Ragavan S <mail2venkat21@gmail.com>\n---\n    refs: fix loose-ref seeking across directory boundaries\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2258%2Fvenkatr21%2Fvenkatr21%2Ffix-loose-ref-seek-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2258/venkatr21/venkatr21/fix-loose-ref-seek-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2258\n\n refs/ref-cache.c               |  6 ++--\n t/t6302-for-each-ref-filter.sh | 55 ++++++++++++++++++++++++++++++++++\n 2 files changed, 59 insertions(+), 2 deletions(-)\n\ndiff --git a/refs/ref-cache.c b/refs/ref-cache.c\nindex ffef01a597..a3bc2dc11b 100644\n--- a/refs/ref-cache.c\n+++ b/refs/ref-cache.c\n@@ -506,7 +506,7 @@ static int cache_ref_iterator_seek(struct ref_iterator *ref_iterator,\n \t\t\tsort_ref_dir(dir);\n \n \t\t\tslash = strchr(slash, '/');\n-\t\t\tlen = slash ? (size_t)(slash - refname) : strlen(refname);\n+\t\t\tlen = slash ? (size_t)(slash - refname + 1) : strlen(refname);\n \n \t\t\tfor (idx = 0; idx < dir->nr; idx++) {\n \t\t\t\tcmp = strncmp(refname, dir->entries[idx]->name, len);\n@@ -520,6 +520,8 @@ static int cache_ref_iterator_seek(struct ref_iterator *ref_iterator,\n \t\t\t\tslash = slash + 1;\n \n \t\t\tlevel->index = idx;\n+\t\t\tif (cmp > 0)\n+\t\t\t\tbreak;\n \t\t\tif (dir->entries[idx]->flag & REF_DIR) {\n \t\t\t\t/* push down a level */\n \t\t\t\tdir = get_ref_dir(dir->entries[idx]);\n@@ -532,7 +534,7 @@ static int cache_ref_iterator_seek(struct ref_iterator *ref_iterator,\n \t\t\t\tlevel->prefix_state = PREFIX_CONTAINS_DIR;\n \t\t\t} else {\n \t\t\t\t/* reduce the index so the leaf node is iterated over */\n-\t\t\t\tif (cmp <= 0 && !slash)\n+\t\t\t\tif (cmp < 0 || (cmp == 0 && !slash))\n \t\t\t\t\tlevel->index = idx - 1;\n \t\t\t\t/*\n \t\t\t\t * while the seek path may not be exhausted, our\ndiff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh\nindex 7f060d97bf..826fc1b9f2 100755\n--- a/t/t6302-for-each-ref-filter.sh\n+++ b/t/t6302-for-each-ref-filter.sh\n@@ -746,6 +746,61 @@ test_expect_success 'start after used with a pattern' '\n \ttest_cmp expect actual\n '\n \n+for storage in loose packed mixed\n+do\n+\ttest_expect_success \"start after respects directory boundaries ($storage)\" '\n+\t\ttest_when_finished \"rm -rf repo\" &&\n+\t\tgit init repo &&\n+\t\t(\n+\t\t\tcd repo &&\n+\t\t\ttest_commit --no-tag base &&\n+\t\t\tgit update-ref refs/tags/packed HEAD &&\n+\t\t\tif test \"$storage\" = mixed\n+\t\t\tthen\n+\t\t\t\tgit pack-refs --all || return 1\n+\t\t\tfi &&\n+\t\t\tgit update-ref --stdin <<-\\EOF &&\n+\t\t\tcreate refs/tags/a-leaf HEAD\n+\t\t\tcreate refs/tags/a/nested HEAD\n+\t\t\tcreate refs/tags/a0 HEAD\n+\t\t\tcreate refs/tags/b HEAD\n+\t\t\tcreate refs/tags/releases-z HEAD\n+\t\t\tcreate refs/tags/releases/v1 HEAD\n+\t\t\tcreate refs/tags/releases/v2 HEAD\n+\t\t\tEOF\n+\t\t\tif test \"$storage\" = packed\n+\t\t\tthen\n+\t\t\t\tgit pack-refs --all || return 1\n+\t\t\tfi &&\n+\t\t\techo refs/tags/releases/v2 >expect &&\n+\t\t\tgit for-each-ref --no-sort --format=\"%(refname)\" \\\n+\t\t\t\t--start-after=refs/tags/releases/v1 >actual &&\n+\t\t\ttest_cmp expect actual &&\n+\t\t\tcat >expect <<-\\EOF &&\n+\t\t\trefs/tags/a0\n+\t\t\trefs/tags/b\n+\t\t\trefs/tags/packed\n+\t\t\trefs/tags/releases-z\n+\t\t\trefs/tags/releases/v1\n+\t\t\trefs/tags/releases/v2\n+\t\t\tEOF\n+\t\t\tgit for-each-ref --no-sort --format=\"%(refname)\" \\\n+\t\t\t\t--start-after=refs/tags/a/next >actual &&\n+\t\t\ttest_cmp expect actual &&\n+\t\t\ttail -n 5 expect >expect-later &&\n+\t\t\tgit for-each-ref --no-sort --format=\"%(refname)\" \\\n+\t\t\t\t--start-after=refs/tags/aa/missing >actual &&\n+\t\t\ttest_cmp expect-later actual &&\n+\t\t\tfor marker in refs/tags/zzzz refs/zzzz zzzz\n+\t\t\tdo\n+\t\t\t\tgit for-each-ref --no-sort --format=\"%(refname)\" \\\n+\t\t\t\t\t--start-after=\"$marker\" >actual &&\n+\t\t\t\ttest_must_be_empty actual || return 1\n+\t\t\tdone\n+\t\t)\n+\t'\n+done\n+\n test_expect_success 'start after used with custom sort order' '\n \tcat >expect <<-\\EOF &&\n \tfatal: cannot use --start-after with custom sort options\n\nbase-commit: a018953688f1b10bddf91bff8747068f5f4746a4\n-- \ngitgitgadget\n\n"},{"id":"555144","messageId":"20261015133624.82112-1-haraldnordgren@gmail.com","threadId":"66544","inReplyTo":"pull.2258.git.1792067455341.gitgitgadget@gmail.com","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Harald Nordgren","fromEmail":"haraldnordgren@gmail.com","sentAt":"2026-10-15T13:36:23Z","receivedAt":"2026-10-15T13:36:23Z","isPatch":true,"sender":{"key":"haraldnordgren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9569897?v=4"},"body":"The general idea looks sound.\n\n> +\t\t\tif test \"$storage\" = mixed\n> +\t\t\tthen\n> +\t\t\t\tgit pack-refs --all || return 1\n> +\t\t\tfi &&\n\nI don't see any reason why a test would need an if block, we know what data we\nexpect, no?\n\n\nHarald\n\n"},{"id":"555169","messageId":"CALnO6CAi_rh_JMOhL0wrHSYZQYCZZstVNFuTxCGCavBnBPe+oQ@mail.gmail.com","threadId":"66544","inReplyTo":"20261015133624.82112-1-haraldnordgren@gmail.com","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"D. Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2026-10-15T17:08:16Z","receivedAt":"2026-10-15T17:08:16Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"On Thu, Oct 15, 2026 at 10:20 AM Harald Nordgren\n<haraldnordgren@gmail.com> wrote:\n[snip]\n> > +                     if test \"$storage\" = mixed\n> > +                     then\n> > +                             git pack-refs --all || return 1\n> > +                     fi &&\n>\n> I don't see any reason why a test would need an if block, we know what data we\n> expect, no?\n\nI didn't examine too closely, but this test is wrapped in a loop over\nthe storage variable that appears to determine whether and when we\npack-refs, so I think the conditional makes sense for that?\n\n-- \nD. Ben Knoble\n\n"},{"id":"555183","messageId":"CALnO6CDH==atdV5tfHSiTuF6MFNebbjyVEzxBU09=xmU75LYQQ@mail.gmail.com","threadId":"66544","inReplyTo":"CAFuK-oaFyp7QdA=Nrc68cNx1iu803pQSUOZ=f947rRjWbJ7Z5w@mail.gmail.com","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"D. Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2026-10-15T19:04:52Z","receivedAt":"2026-10-15T19:04:52Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"[resending with corrected plain-text ':D]\n\n> On Thu, 15 Oct 2026 at 10:38 PM, D. Ben Knoble <ben.knoble@gmail.com> wrote:\n>>\n>> On Thu, Oct 15, 2026 at 10:20 AM Harald Nordgren\n>> <haraldnordgren@gmail.com> wrote:\n>> [snip]\n>> > > +                     if test \"$storage\" = mixed\n>> > > +                     then\n>> > > +                             git pack-refs --all || return 1\n>> > > +                     fi &&\n>> >\n>> > I don't see any reason why a test would need an if block, we know what data we\n>> > expect, no?\n>>\n>> I didn't examine too closely, but this test is wrapped in a loop over\n>> the storage variable that appears to determine whether and when we\n>> pack-refs, so I think the conditional makes sense for that?\n\nOn Thu, Oct 15, 2026 at 1:13 PM Venkat Ragavan <mail2venkat21@gmail.com> wrote:\n>\n> Yes it does, I interpreted Harald’s suggestion was to write separate tests instead of looping over a variable outside the test block, either ways the logic of the test is going to remain the same.\n\n[we bottom-post here]\n\nI don’t mind the loop, personally; it might be worth looking around\nfor other tests and see how they approach it.\n\nYou can also extract shared sections into functions if that makes\nwriting separate tests easier.\n\n-- \nD. Ben Knoble\n\n"},{"id":"555184","messageId":"xmqqse26n5fa.fsf@gitster.g","threadId":"66544","inReplyTo":"20261015133624.82112-1-haraldnordgren@gmail.com","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-15T19:13:13Z","receivedAt":"2026-10-15T19:13:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Harald Nordgren <haraldnordgren@gmail.com> writes:\n\n> The general idea looks sound.\n>\n>> +\t\t\tif test \"$storage\" = mixed\n>> +\t\t\tthen\n>> +\t\t\t\tgit pack-refs --all || return 1\n>> +\t\t\tfi &&\n>\n> I don't see any reason why a test would need an if block, we know what data we\n> expect, no?\n\nThis is three tests implemented as a single test with a for-loop\naround it.  The variable instructs the single test_expect_success\nto behave slightly differently depending on its setting.\n\n+for storage in loose packed mixed\n+do\n+\ttest_expect_success \"start after respects directory boundaries ($storage)\" '\n+\t\ttest_when_finished \"rm -rf repo\" &&\n+\t\tgit init repo &&\n+\t\t(\n+\t\t\tcd repo &&\n+\t\t\ttest_commit --no-tag base &&\n+\t\t\tgit update-ref refs/tags/packed HEAD &&\n+\t\t\tif test \"$storage\" = mixed\n+\t\t\tthen\n+\t\t\t\tgit pack-refs --all || return 1\n+\t\t\tfi &&\n+\t\t\tgit update-ref --stdin <<-\\EOF &&\n+\t\t\tcreate refs/tags/a-leaf HEAD\n+\t\t\t...\n+\t\t\tEOF\n+\t\t\tif test \"$storage\" = packed\n+\t\t\tthen\n+\t\t\t\tgit pack-refs --all || return 1\n+\t\t\tfi &&\n+\t\t\t... real test in the repository begins ...\n+\t\t)\n+\t'\n+done\n\nIt creates a tag \"packed\", and packs when storage is \"mixed\".  Then\nwe create many other refs, and packs the whole refs when storage is\n\"packed\".  So during these three runs of the for-loop, the preparation\npart quoted above behaves this way:\n\n    storage=loose\tno 'git pack-refs' run and every ref is loose\n    storage=packed\tthe later 'git pack-refs' packs everything\n    storage=mixed\t'packed' tag is packed, everything else is loose\n\nand the test checks what happens in this repository with refs packed\nin three different ways.\n\n"},{"id":"555197","messageId":"CAHwyqnWX-3NXtFkKZvKeGweNqYFOp+A5NLgf+aO2iuwg_c2t7Q@mail.gmail.com","threadId":"66544","inReplyTo":"xmqqse26n5fa.fsf@gitster.g","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Harald Nordgren","fromEmail":"haraldnordgren@gmail.com","sentAt":"2026-10-15T21:17:05Z","receivedAt":"2026-10-15T21:17:05Z","isPatch":true,"sender":{"key":"haraldnordgren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9569897?v=4"},"body":"> > The general idea looks sound.\n> >\n> >> +                    if test \"$storage\" = mixed\n> >> +                    then\n> >> +                            git pack-refs --all || return 1\n> >> +                    fi &&\n> >\n> > I don't see any reason why a test would need an if block, we know what data we\n> > expect, no?\n>\n> This is three tests implemented as a single test with a for-loop\n> around it.  The variable instructs the single test_expect_success\n> to behave slightly differently depending on its setting.\n\nI realize now that I didn't read the code properly. I didn't expect to\nsee a loop encapsulating a call to test_expect_success. That explains\nthe if case as well.\n\n\nHarald\n\n"},{"id":"555206","messageId":"CAFuK-oarU1rZOcDzYr=YA1SNvfAzyB6LaXXCjtZV6WWGswOnyw@mail.gmail.com","threadId":"66544","inReplyTo":"CAFuK-obau8UkmVVs0xkuwjddkqftMxwcGnGR640YqjswGrTj3Q@mail.gmail.com","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Venkat Ragavan","fromEmail":"mail2venkat21@gmail.com","sentAt":"2026-10-16T03:19:38Z","receivedAt":"2026-10-16T03:19:38Z","isPatch":true,"sender":{"key":"mail2venkat21@gmail.com","avatar":null},"body":"[Resending as plain text after the mailing list rejected the HTML version.]\n\n> I realize now that I didn't read the code properly. I didn't expect to\n> see a loop encapsulating a call to test_expect_success. That explains\n> the if case as well.\n\nThanks for following up, and thanks Junio for explaining the setup. Since\nthe loop intentionally exercises loose, packed, and mixed ref layouts, I'll\nleave the test unchanged.\n\n\nOn Fri, Oct 16, 2026 at 8:47 AM Venkat Ragavan <mail2venkat21@gmail.com> wrote:\n>\n> > I realize now that I didn't read the code properly. I didn't expect to\n> > see a loop encapsulating a call to test_expect_success. That explains\n> > the if case as well.\n>\n> Thanks for following up, and thanks Junio for explaining the setup. Since\n> the loop intentionally exercises loose, packed, and mixed ref layouts, I’ll\n> leave the test unchanged.\n>\n> On Fri, Oct 16, 2026 at 2:47 AM Harald Nordgren <haraldnordgren@gmail.com> wrote:\n>>\n>> > > The general idea looks sound.\n>> > >\n>> > >> +                    if test \"$storage\" = mixed\n>> > >> +                    then\n>> > >> +                            git pack-refs --all || return 1\n>> > >> +                    fi &&\n>> > >\n>> > > I don't see any reason why a test would need an if block, we know what data we\n>> > > expect, no?\n>> >\n>> > This is three tests implemented as a single test with a for-loop\n>> > around it.  The variable instructs the single test_expect_success\n>> > to behave slightly differently depending on its setting.\n>>\n>> I realize now that I didn't read the code properly. I didn't expect to\n>> see a loop encapsulating a call to test_expect_success. That explains\n>> the if case as well.\n>>\n>>\n>> Harald\n\n"},{"id":"556587","messageId":"xmqqzevyg4w7.fsf@gitster.g","threadId":"66544","inReplyTo":"pull.2258.git.1792067455341.gitgitgadget@gmail.com","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-27T22:22:48Z","receivedAt":"2026-10-27T22:22:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Venkat Ragavan via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Venkat Ragavan S <mail2venkat21@gmail.com>\n>\n> When seeking through loose refs, cache_ref_iterator_seek() compares\n> each directory component without its trailing slash. This can confuse\n> a directory with a similarly named ref that sorts before it.\n> ...\n> Add regression tests for shared-prefix names, missing nested markers,\n> and markers beyond the end of the ref listing, using loose, packed,\n> and mixed refs.\n>\n> Signed-off-by: Venkat Ragavan S <mail2venkat21@gmail.com>\n> ---\n>     refs: fix loose-ref seeking across directory boundaries\n\nI overlooked this topic, but re-reading the discussion, aside from a\ntest that confused a reader, it seems the topic was already ready to\ngo?\n\nAny objections to the idea of making the topic ready for 'next'?\n\nThanks.\n\n"},{"id":"556620","messageId":"auG4977CYFRTJVRQ@pks.im","threadId":"66544","inReplyTo":"pull.2258.git.1792067455341.gitgitgadget@gmail.com","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-28T08:57:27Z","receivedAt":"2026-10-28T08:57:27Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Thu, Oct 15, 2026 at 12:30:55PM +0000, Venkat Ragavan via GitGitGadget wrote:\n> From: Venkat Ragavan S <mail2venkat21@gmail.com>\n> \n> When seeking through loose refs, cache_ref_iterator_seek() compares\n> each directory component without its trailing slash. This can confuse\n> a directory with a similarly named ref that sorts before it.\n\nThis observes the status quo, but it doesn't give us any context _why_\nwe even did this. I'm sure there must've been a reason for this, but the\nreader will have to figure it out by themselves.\n\n> For example, with these refs:\n> \n>     refs/tags/releases-z\n>     refs/tags/releases/v1\n>     refs/tags/releases/v2\n> \n> Starting after refs/tags/releases/v1 can position the iterator at\n> releases-z instead of descending into releases/. Iteration then\n> returns v1 again, even though it should return only v2.\n\nIt would have been great to demonstrate how this is visible to the user.\nE.g., can this be shown with a simple call to git-for-each-ref(1)?\n\n> Include the trailing slash when comparing directory components so\n> that the seek follows the correct directory.\n> \n> Also handle two related positioning errors. If every entry in a\n> directory precedes the cursor, stop searching that level rather than\n> descending into its last entry. If a leaf sorts after the cursor,\n> leave the iterator positioned to return it, even when the cursor has\n> remaining path components.\n\nAre thse separate bugs? If so, it would've made sense to split this\nseries into three separate commit so that we can fix the individual bugs\none by one, right?\n\n> diff --git a/refs/ref-cache.c b/refs/ref-cache.c\n> index ffef01a597..a3bc2dc11b 100644\n> --- a/refs/ref-cache.c\n> +++ b/refs/ref-cache.c\n> @@ -532,7 +534,7 @@ static int cache_ref_iterator_seek(struct ref_iterator *ref_iterator,\n>  \t\t\t\tlevel->prefix_state = PREFIX_CONTAINS_DIR;\n>  \t\t\t} else {\n>  \t\t\t\t/* reduce the index so the leaf node is iterated over */\n> -\t\t\t\tif (cmp <= 0 && !slash)\n> +\t\t\t\tif (cmp < 0 || (cmp == 0 && !slash))\n>  \t\t\t\t\tlevel->index = idx - 1;\n>  \t\t\t\t/*\n>  \t\t\t\t * while the seek path may not be exhausted, our\n\nTiny nit: we usually don't explicitly compare for equality (or\ninequality) with 0, but rather write `cmp` or `!cmp`.\n\n> diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh\n> index 7f060d97bf..826fc1b9f2 100755\n> --- a/t/t6302-for-each-ref-filter.sh\n> +++ b/t/t6302-for-each-ref-filter.sh\n> @@ -746,6 +746,61 @@ test_expect_success 'start after used with a pattern' '\n>  \ttest_cmp expect actual\n>  '\n>  \n> +for storage in loose packed mixed\n> +do\n> +\ttest_expect_success \"start after respects directory boundaries ($storage)\" '\n> +\t\ttest_when_finished \"rm -rf repo\" &&\n> +\t\tgit init repo &&\n> +\t\t(\n> +\t\t\tcd repo &&\n> +\t\t\ttest_commit --no-tag base &&\n> +\t\t\tgit update-ref refs/tags/packed HEAD &&\n> +\t\t\tif test \"$storage\" = mixed\n> +\t\t\tthen\n> +\t\t\t\tgit pack-refs --all || return 1\n> +\t\t\tfi &&\n\nOkay. These are a bit funny in the context of the reftable backend, but\nI agree it makes sense to have this anyway. Doesn't hurt much to have\nextra coverage.\n\nThanks!\n\nPatrick\n\n"},{"id":"556621","messageId":"auG5NTowgVZG9L2Q@pks.im","threadId":"66544","inReplyTo":"xmqqzevyg4w7.fsf@gitster.g","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-28T08:58:29Z","receivedAt":"2026-10-28T08:58:29Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Oct 27, 2026 at 03:22:48PM -0700, Junio C Hamano wrote:\n> \"Venkat Ragavan via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n> > From: Venkat Ragavan S <mail2venkat21@gmail.com>\n> >\n> > When seeking through loose refs, cache_ref_iterator_seek() compares\n> > each directory component without its trailing slash. This can confuse\n> > a directory with a similarly named ref that sorts before it.\n> > ...\n> > Add regression tests for shared-prefix names, missing nested markers,\n> > and markers beyond the end of the ref listing, using loose, packed,\n> > and mixed refs.\n> >\n> > Signed-off-by: Venkat Ragavan S <mail2venkat21@gmail.com>\n> > ---\n> >     refs: fix loose-ref seeking across directory boundaries\n> \n> I overlooked this topic, but re-reading the discussion, aside from a\n> test that confused a reader, it seems the topic was already ready to\n> go?\n> \n> Any objections to the idea of making the topic ready for 'next'?\n\nSorry, I lost track of this patch series, but I've reviewed it now.\nOverall this looks good, but I wonder whether this really should be\nsplit up into three patches because as far as I understand, this single\npatch solves three separate bugs at once.\n\nPatrick\n\n"},{"id":"556682","messageId":"xmqqo6cdbxl1.fsf@gitster.g","threadId":"66544","inReplyTo":"auG5NTowgVZG9L2Q@pks.im","subject":"Re: [PATCH] refs: fix loose-ref seeking across directory boundaries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-28T16:26:34Z","receivedAt":"2026-10-28T16:26:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Tue, Oct 27, 2026 at 03:22:48PM -0700, Junio C Hamano wrote:\n>> \"Venkat Ragavan via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>> \n>> > From: Venkat Ragavan S <mail2venkat21@gmail.com>\n>> >\n>> > When seeking through loose refs, cache_ref_iterator_seek() compares\n>> > each directory component without its trailing slash. This can confuse\n>> > a directory with a similarly named ref that sorts before it.\n>> > ...\n>> > Add regression tests for shared-prefix names, missing nested markers,\n>> > and markers beyond the end of the ref listing, using loose, packed,\n>> > and mixed refs.\n>> >\n>> > Signed-off-by: Venkat Ragavan S <mail2venkat21@gmail.com>\n>> > ---\n>> >     refs: fix loose-ref seeking across directory boundaries\n>> \n>> I overlooked this topic, but re-reading the discussion, aside from a\n>> test that confused a reader, it seems the topic was already ready to\n>> go?\n>> \n>> Any objections to the idea of making the topic ready for 'next'?\n>\n> Sorry, I lost track of this patch series, but I've reviewed it now.\n> Overall this looks good, but I wonder whether this really should be\n> split up into three patches because as far as I understand, this single\n> patch solves three separate bugs at once.\n>\n> Patrick\n\nThanks.  Let's hear from the author, then.\n\n"}]}