Shock formation in the presence of entropy gradients