Update `tap --repair` function to ignore non-directory files

Addresses #17511