This is a complete rewrite of the previous series, following a
suggestion by Jonathan Nieder. It is much more generic than the
previous one, and removes existing duplicated code in diffcore-rename.
I also had a quick look at other binary-search occurences in the code
that would share the same search code. That revealed
index_name_pos(): not sure it is a good idea to make it use this API -
it would require changes all over the code. I still include a
possibly-useful additional API for similar cases.