[1.7.x] Fixed #22194 -- Added --list-tags option to check command.

Thanks Elvard for the patch.

Backport of 395d75ea6b from master