1

Gitlab CI uses this code for globs:

File.fnmatch?(glob, path, File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_EXTGLOB)

If I want to match all files and folders under a directory I think you have to do this:

foo/*
foo/**/*

That sucks. I thought this would work:

foo/**

But it only works without FNM_PATHNAME. The Ruby docs for this are extremely bad. What exactly is going on here? Is there a single pattern that will match foo/a and foo/a/b?

Timmmm
  • 88,195
  • 71
  • 364
  • 509
  • 1
    Looks like `foo/**` is in fnmatch broken, and perhaps that's why its not being used across GitLab examples – piotr_cz Aug 03 '23 at 14:09

1 Answers1

0

Ok so it turns out that foo/**/* does match foo/a only if you have FNM_PATHNAME.

Timmmm
  • 88,195
  • 71
  • 364
  • 509