Leaders of Germany’s coalition parties have come to an agreement to fix the country’s diesel crisis after marathon talks late into the night.