diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-09-11 10:33:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-11 10:33:35 -0700 |
commit | 294792326ae86c276897a0fd694948d2fb5640de (patch) | |
tree | ae654ed33d74c0102cc586ea8a3e026c94427d5e /walker.c | |
parent | Merge branch 'jk/fast-import-fixes' (diff) | |
parent | walker: avoid quadratic list insertion in mark_complete (diff) | |
download | tgif-294792326ae86c276897a0fd694948d2fb5640de.tar.xz |
Merge branch 'rs/list-optim'
Fix a couple of "accumulate into a sorted list" to "accumulate and
then sort the list".
* rs/list-optim:
walker: avoid quadratic list insertion in mark_complete
sha1_name: avoid quadratic list insertion in handle_one_ref
Diffstat (limited to 'walker.c')
-rw-r--r-- | walker.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -205,7 +205,7 @@ static int mark_complete(const char *path, const unsigned char *sha1, int flag, struct commit *commit = lookup_commit_reference_gently(sha1, 1); if (commit) { commit->object.flags |= COMPLETE; - commit_list_insert_by_date(commit, &complete); + commit_list_insert(commit, &complete); } return 0; } @@ -267,8 +267,11 @@ int walker_fetch(struct walker *walker, int targets, char **target, goto done; } } - if (!walker->get_recover) + + if (!walker->get_recover) { for_each_ref(mark_complete, NULL); + commit_list_sort_by_date(&complete); + } for (i = 0; i < targets; i++) { if (interpret_target(walker, target[i], &sha1[20 * i])) { |