commit: Make CDPATH handling portable, accept entries not matching "/$".