It depends on your situation. If your finances are really out of control and bankruptcy is the only practical option, then bankruptcy isn’t worse than a repossession.
Repossession vs Bankruptcy
A repossession is normally a sign of a much bigger problem which is too much debt and not enough income. If your only problem was the inability to afford a vehicle and you really don’t have other significant financial problems, then naturally it would be better to avoid bankruptcy.
Perhaps a bankruptcy filing would be considered more harmful to your credit, but in the long term, if bankruptcy is necessary to get a fresh start, and things just won’t get better otherwise, then bankruptcy certainly wouldn’t be worse than repossession.