Skip to content

Commit 2f382ab

Browse files
committed
mwindow: Fix a bug in the LRU window finding code
This change now updates the `lru_window` variable to match the current file's MRU window. This makes it such that it doesn't always choose the file that happened to come last in the list of window files, and instead should now correctly choose the file with the least-recently-used one.
1 parent 3392da3 commit 2f382ab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mwindow.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,10 @@ static int git_mwindow_find_lru_file_locked(git_mwindow_file **out)
312312
current_file, &mru_window, NULL, true, GIT_MWINDOW__MRU)) {
313313
continue;
314314
}
315-
if (!lru_window || lru_window->last_used > mru_window->last_used)
315+
if (!lru_window || lru_window->last_used > mru_window->last_used) {
316+
lru_window = mru_window;
316317
lru_file = current_file;
318+
}
317319
}
318320

319321
if (!lru_file) {

0 commit comments

Comments
 (0)