CircleCI-Public / path-filtering-orb

MIT License
24 stars 62 forks source link

Set parameters fails when base-revision branch name and a directory in the root directory share the same name #50

Closed jckeme-rs closed 1 year ago

jckeme-rs commented 2 years ago

Orb version: path-filtering: circleci/path-filtering@0.1.3

What happened:

I have a directory named master within the root of my repository. And coincidentally, my base revision branch is the master branch.

The path-filtering/set-parameters step always fails when I have base-revision set to master because that directory exists in the root of my repository. The Git checkout command has no clarity on if this should be a local file (pathspec) checkout or a tracking branch checkout, so that step fails and terminates the pipeline.

fatal: 'master' could be both a local file and a tracking branch.
Please use -- (and optionally --no-guess) to disambiguate
Traceback (most recent call last):
  File "<string>", line 23, in <module>
  File "<string>", line 15, in checkout
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'checkout', 'master']' returned non-zero exit status 128.

There is no workaround for this since the base-revision branch name is being passed in as an argument into the python command. I've tried to bypass for example:

error: pathspec 'master --' did not match any file(s) known to git
Traceback (most recent call last):
  File "<string>", line 23, in <module>
  File "<string>", line 15, in checkout
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'checkout', 'master --']' returned non-zero exit status 1

Expected behavior:

The path filtering orb might need to offer a new disambiguate parameter which makes the checkout process dynamic. If the parameter is specified as true, then the disambiguate (--) flag should be passed in during the checkout process. Otherwise, it can be left as is.

Additional Information:

Fernando-Abreu commented 1 year ago

Changing this label to feature request

Fernando-Abreu commented 1 year ago

This issue is very specific and we won't have the bandwidth to address this. A possible workaround could be changing the directory name.