ls-files: move only kept cache entries in prune_cache()
commit96f6d3f61ad02ef2fd0393765207233845a7c7e0
authorRené Scharfe <l.s.r@web.de>
Fri, 10 Feb 2017 20:03:30 +0000 (10 21:03 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Feb 2017 20:06:10 +0000 (13 12:06 -0800)
tree5aea76d086b7c1ab0d2131f743d12c3d3fff69d8
parent7b4158a8d8d027491e6e2f7eff3789bd25e093d5
ls-files: move only kept cache entries in prune_cache()

prune_cache() first identifies those entries at the start of the sorted
array that can be discarded.  Then it moves the rest of the entries up.
Last it identifies the unwanted trailing entries among the moved ones
and cuts them off.

Change the order: Identify both start *and* end of the range to keep
first and then move only those entries to the top.  The resulting code
is slightly shorter and a bit more efficient.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-files.c