add_file_to_index: skip rehashing if the cached stat already matches
An earlier commit
366bfcb6 broke git-add by moving read_cache()
call down, because it wanted the directory walking code to grab
paths that are already in the index. The change serves its
purpose, but introduces a regression because the responsibility
of avoiding unnecessary reindexing by matching the cached stat
is shifted nowhere.
This makes it the job of add_file_to_index() function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>