RGlobs.to_filespec should generate filespecs that match git spec

Review Request #4078 - Created July 13, 2016 and submitted

Information
Yujie Chen
pants
3413, 3664
Reviewers
pants-reviews
kwlzn, nhoward_tw, stuhood

In v1 engine's rglobs implementation, '**' matches 1 or more dirs.

In v2 engine, we want to make rglobs follow git spec, which means '**' in BUILD file should match 0 or more dirs.

v2 engine used to treat '**' as matching 1 or more dirs. Thus for a pattern like 'a/**/*.py', RGlobs.to_filespec will generate 2 filespecs: 'a/**/*.py' and 'a/*.py', to make '**' from BUILD files match 0 or more dirs. However, after https://rbcommons.com/s/twitter/r/4034/, v2 engine started to match '**' with 0 or more dirs directly. The additional logic of handling '**' in RGlobs.to_filespec can be removed then.

In this patch,
1. RGlobs.to_filespec is simplified.
2. Add a logic in PathGlob.create to replace consecutive '**' with a single '**'.
3. Fix test failures caused by 1.

ci green:
https://travis-ci.org/pantsbuild/pants/builds/144851041

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Stu Hood
Yujie Chen
Stu Hood
Yujie Chen
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as cb799a7e4c5a9b467ce2acf600124878ae188200

Loading...