git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] sparse-checkout: optimize string_list construction

From
Amisha Chhajed <amishhhaaaa@gmail.com>
Date
Jan 16, 2026, 17:03 UTC
Message-ID
<CAPvEtrc4KuQhNhc966=bbMQUZw1Ne1eoG68mVoZiG6A3h4t=GQ@mail.gmail.com>
In-Reply-To
<20260115200903.GB1053259@coredump.intra.peff.net>

I was able to reproduce this, are we open to a patch adding a test that checks if duplicate entries are present in stdin the result should not have it? because the tests were passing even after removing all duplicates checks, and non duplicates enforcement is a part of the method's behaviour, if I am understanding correctly.

On Fri, 16 Jan 2026 at 01:39, Jeff King <peff@peff.net> wrote:
Show 47 quoted lines
>
> On Thu, Jan 15, 2026 at 06:45:35PM +0530, Amisha Chhajed wrote:
>
> > I was also very curious about the presence of
> > string_list_remove_duplicates in the original code, from my
> > understanding string_list_insert already removed duplicates and
> > string_list_remove_duplicates was still present with it.
>
> Yes, I don't think you could have duplicates when inserting with
> string_list_insert(). Of course your patch removes that, which means
> we're falling back on the notion that the hashmap cannot have
> duplicates, either.
>
> I think our hashmap _does_ allow duplicate entries, though. The
> insertion code in insert_recursive_pattern() avoids duplicates in
> parent_hashmap, but adds its arguments directly to recursive_hashmap.
>
> So I think you could get duplicates with something like:
>
>   git init
>   git sparse-checkout set --cone
>   git sparse-checkout add --stdin <<\EOF
>   foo
>   bar
>   foo
>   EOF
>
> Before your patch, that produces this .git/info/sparse-checkout file:
>
>   /*
>   !/*/
>   /bar/
>   /foo/
>
> and after we get:
>
>   /*
>   !/*/
>   /bar/
>   /foo/
>   /foo/
>
> So I think we do want to retain the duplicate suppression. Switching
> from insert() to append() is still good, as long as we keep the
> remove_duplicates() lines.
>
> -Peff
Previous: Jeff KingNext: René Scharfe
Message 8 of 28 in “sparse-checkout: optimize string_list construction”
  1. sparse-checkout: optimize string_list constructionamisha, Jan 14, 2026
  2. Jeff KingJan 14, 2026
  3. Derrick StoleeJan 18, 2026
  4. sparse-checkout: optimize string_list constructionamisha, Jan 15, 2026
  5. sparse-checkout: optimize string_list constructionamisha, Jan 15, 2026
  6. Amisha ChhajedJan 15, 2026
  7. Jeff KingJan 15, 2026
  8. Amisha ChhajedJan 16, 2026
  9. René ScharfeJan 15, 2026
  10. Amisha ChhajedJan 16, 2026
  11. Junio C HamanoJan 16, 2026
  12. Derrick StoleeJan 18, 2026
  13. Amisha ChhajedJan 18, 2026
  14. Junio C HamanoJan 15, 2026
  15. sparse-checkout: optimize string_list constructionamisha, Jan 16, 2026
  16. Junio C HamanoJan 16, 2026
  17. Amisha ChhajedJan 18, 2026
  18. Jeff KingJan 19, 2026
  19. Junio C HamanoJan 19, 2026
  20. 1/2 sparse-checkout: optimize string_list constructionamisha, Jan 19, 2026
  21. Derrick StoleeJan 19, 2026
  22. Pushkar SinghJan 19, 2026
  23. Amisha ChhajedJan 20, 2026
  24. sparse-checkout: optimize string_list construction and add tests to verify deduplication.amisha, Jan 20, 2026
  25. Derrick StoleeJan 20, 2026
  26. sparse-checkout: optimize string_list construction and add tests to verify deduplication.Amisha Chhajed, Jan 21, 2026
  27. Derrick StoleeJan 21, 2026
  28. Junio C HamanoJan 21, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.