Merge branch 'sc/wt-status-avoid-quadratic-insertion' into jch
The enumeration of untracked and ignored files in 'git status' has been optimized by avoiding quadratic complexity when inserting into string lists, reducing the construction cost from O(n^2) to O(n log n). * sc/wt-status-avoid-quadratic-insertion: wt-status: avoid repeated insertion for untracked pathsjch
commit
4c93084277
|
|
@ -832,14 +832,16 @@ static void wt_status_collect_untracked(struct wt_status *s)
|
|||
for (i = 0; i < dir.nr; i++) {
|
||||
struct dir_entry *ent = dir.entries[i];
|
||||
if (index_name_is_other(istate, ent->name, ent->len))
|
||||
string_list_insert(&s->untracked, ent->name);
|
||||
string_list_append(&s->untracked, ent->name);
|
||||
}
|
||||
string_list_sort_u(&s->untracked, 0);
|
||||
|
||||
for (i = 0; i < dir.ignored_nr; i++) {
|
||||
struct dir_entry *ent = dir.ignored[i];
|
||||
if (index_name_is_other(istate, ent->name, ent->len))
|
||||
string_list_insert(&s->ignored, ent->name);
|
||||
string_list_append(&s->ignored, ent->name);
|
||||
}
|
||||
string_list_sort_u(&s->ignored, 0);
|
||||
|
||||
dir_clear(&dir);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue