Branch permission pattern foo/bar**

Will the branch permission pattern foo/bar** match foo/barbat or does ** only match strictly separated path elements (e.g. foo/bar/bat)? https://confluence.atlassian.com/display/STASH/Branch+permission+patterns isn't totally clear about that.

2 answers

0 vote

Hello Jan,

Thank you for your question.

Based on the documentation you have mentioned and in your inquire, it seems you are interested on knowing how to refer any branch that starts with foo/bar (i.e.: foo/bar, foo/barbat, foo/bare). If so, you could use the following pattern:

foo/bar*

PROJECT-*

Matches any branch or tag named PROJECT-*, even in a name space.

e.g. refs/heads/PROJECT-1234, refs/heads/stable/PROJECT-new or refs/tags/PROJECT-1.1

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

That's true, but not really what I was asking. I'd like to know whether foo/bar** is guaranteed to match foo/barbat (as well as foo/bar/bat, foo/barbat/baz, etc). It's not entirely clear from the spec, at least there is no example mentioning this case.

Hi,

Stash is using Spring's AntPathMatcher internally which is based on Ant patterns. From Ant's documentation:

/test/** matches all files/directories under /test/, such as /test/x.java, or /test/foo/bar/xyz.html, but not /xyz.xml.

which means foo/bar** matches foo/barbat.


Kind regards,

Michael

That's how I read it as well. But it's not totally clear from the spec. It doesn't explicitly mention the case of ** being preceded by anything other than / or nothing.

You're right, it's not clear from the spec. I can only tell from the implementation side how AntPathMatcher is working. Only the code tells the truth :-)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,764 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you