Re: [PATCH Outreachy] mru: use double-linked list from list.h
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 30, 2017, 00:07 UTC
- Message-ID
- <xmqq7ewhvyjq.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170929233723.c7ixg5fb3flbgaom@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Yes, I think we could just call this "list_move_to_front()" or > something. The fact that it's operating on a list called > "packed_git_mru" is probably sufficient to make it clear that the > purpose is managing recentness.
I earlier said I wasn't sure, but I fully agree with your envisioned endgame state, my understanding of which is that we will not have an API that is only to be used to manage a MRU list (hence there will be no mru.[ch] in that future), as there is very small MRU-specific operation to be offered anyway. Namely, mru_mark() that is to be used to "mark the fact that the item was used---do whatever necessary to maintain the MRU list".
Instead, everybody understands how the list API works, and the fact that one instance of list_head is called MRU is sufficient to see that use of "move this to the front of the list" function means we are marking the item as most-recently-used.
Thanks.