Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] Add a way to disable default/base config branch policies #3736

Closed
gerardog opened this issue Oct 24, 2023 · 2 comments
Closed

Comments

@gerardog
Copy link

gerardog commented Oct 24, 2023

It is confusing that there is a set of "secret" default branch policies that cant be easily removed.
Re: #3735

This is my gitversion file

mode: Mainline
branches:
  master:
    regex: '^master$|^main$'  
  other:
    mode: ContinuousDelivery
    regex: '^(?!master$|^main$/).*$'  # All branches except main, master
    tag: '{BranchName}'               # Shall have a prerelease tag based on the branch name.
    source-branches: ['main', 'master']
    increment: patch

... and I dont expect it to throw 'Multiple branch configurations match the current branch' warning because there are 6 implied default policies I need to delete: develop, release, feature, pull-request, hotfix and support
... and that I discovered by chance while diagnosing this warning message, when I ran /showconfig

If I create a branch that matches any of those 6 branch policies regex, while also matching my other, it will throw the error.
This problem was triggered when someone pushed a branch with a naming that matched both policies, like feature/something

The warning break the pipeline as described in #3735

Detailed Description

Context

So I don't have to clutter my gitversion with disabling 6 policies, which i dont know how to do btw. Shall I put bad regex to all of them?.

Possible Implementation

Either:

  • I don't like the idea of a implied (and so large) base config. But I guess remove that is really breaking.
  • Add a config to avoid loading base config branch policies:
  • if the branch regex matches only one user-config policy, dont throw the warning even if it also matches a base-config policy
  • fix the error message [Bug] Unable to suppress "Multiple branch configurations match the current branch"  #3735 Multiple branch configurations match the current branch
@HHobeck
Copy link
Contributor

HHobeck commented Oct 25, 2023

This feature is available since the beta-1 version of git version. The documentation says for the usage of the following property:

workflow

The base template of the configuration to use. Possible values are: GitFlow/v1 or GitHubFlow/v1

If you specify this property to an empty string you do not have any base configuration. Please see also:

Happy branching!

@HHobeck HHobeck closed this as completed Oct 25, 2023
@gerardog
Copy link
Author

Adding workflow: '' does solve the issue but it is undocumented except in the PR itself.
Would you please document workflow at https://gitversion.net/docs/reference/configuration ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants