Gasoline cars may have very "clean" emissions, but it's the CO2 that's doing the greatest harm.
Diesels may emit more smog and other harmful gas (sulfates and NOx), but CO2 emissions is very low. With several new technologies (particle filters, low-sulfur diesel, UREA filters), the three major complaints about diesel engines are now all addressed.
California's exclusion of diesels from smog tests is probably a loop-hole that accommodates big trucks. On the other hand, most European countries exclude diesels from smog tests too, and that's an acknowledgment that between smog and CO2, the former is the lesser of two evils.