RmFilesRecursive should not attempt to delete directories

What does this MR do?

RmFilesRecursive should not attempt to delete directories

Observations:

  • RmFilesRecursive on bash tried to delete directories, but failed
  • RmFilesRecursive on pwsh (and powershell?) deleted directories too

With this change we

  • only attempt to delete files, not directories
  • have RmFilesRecursive behave the same across shells

Why was this MR needed?

To fix the reported issue Error in GitLab runner version v17.10.0 and cle... (#38681 - closed): They have a submodule "config" which the cleanup mechanism attempted to delete. It should, however, not delete the submodule's directory (the bare checkout), but only the file "config" within that directory.

What's the best way to test this MR?

Either use a submodule with the name config (or drop a directory named config into ~/.git/modules by any other means) and see that

  • the job does not fail
  • .../.git/modules/config is not deleted
  • .../.git/modules/config/config is deleted

across all shells / OSs

What are the relevant issue numbers?

closes: Error in GitLab runner version v17.10.0 and cle... (#38681 - closed)

Edited by Hannes Hörl

Merge request reports

Loading