[JENKINS-23146] Handle changes to folder checked out to '.'

(cherry picked from commit 3df6c0b32db52e275ff6158b93e2022c0067625c)