It would certainly damage both engines if you tried to run them for any length of time, though the petrol engine would probably break down first. While both types have to ignite their fuel first to run, petrol engines do this with an electric spark and suck the fuel through with carburettors, while diesel engines inject the fuel directly into the cylinder and ignite the fuel by compressing it.
Diesel has a lower auto ignition temperature than petrol, so while petrol won’t ignite in a compression ignition engine and will cause the vehicle to stall, diesel in a spark ignition engine ignites too easily and burns with more power than a petrol engine is designed for, damaging it.