summaryrefslogtreecommitdiff
path: root/gitweb/gitweb.cgi
diff options
context:
space:
mode:
authorSahitya Chandra <sahityajb@gmail.com>2026-07-18 13:44:49 +0530
committerJunio C Hamano <gitster@pobox.com>2026-07-19 16:21:33 -0700
commit7b2648f7454e4d2bfbb78e303ec23d9997e4c985 (patch)
tree15722b4aebb1b6cb0050ea78a33fdb0eb8a89d5e /gitweb/gitweb.cgi
parentd35c5399e3e54ac277bb391fc2f6be3e816d312b (diff)
wt-status: avoid repeated insertion for untracked paths
wt_status_collect_untracked() copies entries from dir.entries and dir.ignored into string_lists using string_list_insert(). At first glance this seems quadratic, because inserting into the sorted list may shift the backing array, incurring O(n) work for each insert. In practice, though, the entries in the dir struct are already sorted, so we should not have to shift the array and only pay the O(log n) lookup cost for each insertion. But this is subtle and depends on the behavior of fill_directory(). Collect the entries with string_list_append() instead, then sort and deduplicate each list once with string_list_sort_u(). This preserves the sorted, duplicate-free result while making the collection strategy explicit. Signed-off-by: Sahitya Chandra <sahityajb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/gitweb.cgi')
0 files changed, 0 insertions, 0 deletions