Handle the case in which some automatic merge left unhandled files around.

Now we set up the sparse checkout early, at the beginning of the first merge,
so that all the operations happen with the correct configuration.