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

Define multible branch prefixes and conventional strategie only #12

Open
heavySea opened this issue Oct 19, 2022 · 8 comments
Open

Define multible branch prefixes and conventional strategie only #12

heavySea opened this issue Oct 19, 2022 · 8 comments

Comments

@heavySea
Copy link

First of all, thank you for this helpfull tool!

In our use-case we want to synchronise a local copy of a customers fairly large git. For this we only want to synchronize a few branches. But these do not have a common prefix.

Is it possible, that you define multiple branch names/prefixes?

Moreover is it possible to select the conventional conflict solving strategie only and as default? For now it seem, that you have to set a branch in victim_branches_prefix or the whole repository is synced.

Thank you in advance.

@it3xl
Copy link
Owner

it3xl commented Oct 19, 2022

Hello @heavySea,
good questions, thank you.

I need some time to remember. So my answers won't be accurate now. But I'll give them right now.

@it3xl
Copy link
Owner

it3xl commented Oct 19, 2022

Synchronization of few none prefixed branches in a single project.

Workaround

Could you use multiple projects for the same pair of remote repositories?
For example. In one project it will be

url_a=https://example.com/git/my_repo.git
#
url_b='/c/my-folder/my-local-git-repo-folder'

side_a_conventional_branches_prefix=one-branch

In another project

url_a=https://example.com/git/my_repo.git
#
url_b='/c/my-folder/my-local-git-repo-folder'

side_a_conventional_branches_prefix=branch-for-a-feature

etc.
But this will continue to behave like a prefixes. So if you have the following branches

  • one-branch
  • one-branch-2

the both will be synchronized for side_a_conventional_branches_prefix=one-branch configuration.

Yes, this is stupid, I understand. Also, it will give you some storage and network overhead.

Solution

First of all, I can't imagine how to configure it conveniently.

  • We have prefixes now.
  • We will be having list of branches.
  • How to separate those branch names?
  • Use additional variables? OK. But how to be if I'll add another sync strategy later? OK, analyze and parse a bunch of configuration.
  • Put everything in the existing variables? How? How to parse everything. Branches and prefixes separately.

So, you see. Configuration, documentation, development and testing will grow. :)

@it3xl
Copy link
Owner

it3xl commented Oct 19, 2022

Disable the Victim Conflict Solving

Workaround

Use something like this in your project configuration.

victim_branches_prefix=abracadabra

or

victim_branches_prefix=we-do-not-use-victim-conflict-solving-@@@

Solution

I could add an additional parameter later. Right!
Or propose another solution, please.

@it3xl
Copy link
Owner

it3xl commented Oct 19, 2022

And @heavySea, sorry for inconveniences.

@heavySea
Copy link
Author

heavySea commented Oct 19, 2022

Hello @it3xl,
thank you for your fast response and suggestions.

  1. Using multiple sync-projects for the same repository sites.

Yes we already thought of this workaround. I guess this would work for us at the moment, since we only need to sync a few branches, that have not a common prefix. Though, one drawback is, that it creates local clones of the repository as many times as there are sync-repositories. With large repos this will accumulate quite fast.
Nevertheless this is probably the solution we are going to use for now, if needed.

I see your problem with the differentiation between prefix and complete branch names.
Maybe you could use the common wildcard symbol '*' to hint that there can be an arbitrary input behind the prefix.
For example: 'branchA-' would be a single branch with this name and 'branchA-*' is a prefix so 'branchA-XYZ' is also included.

  1. Disable victim conflict solving

That seems like a fairly hacky workaround, but we are going to test it.
Nevertheless it seems quite unintuitive, that leaving victim_branches_prefix unset but not victim_branches_prefix resulting in syncing all branches. It would be more intuitive if either
a. both variables are unset, i.a. nothing is filtered
or
b. use the wildcard symbol '*' again and set either victim_branches_prefix=* or victim_branches_prefix=* to sync all branches either with conventional or victim stategy.

Again I would like to thank you for this tool, which otherwise works very well, and your support.

@it3xl
Copy link
Owner

it3xl commented Oct 21, 2022

The star symbol is allowable to use in Git branch names if REFNAME_REFSPEC_PATTERN is set. AFAIK

@it3xl
Copy link
Owner

it3xl commented Oct 21, 2022

Maybe "~"

@it3xl
Copy link
Owner

it3xl commented Oct 21, 2022

So, if I put everything in the existing variables and created a single parsing logic this will be good.
Many thanks.

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

No branches or pull requests

2 participants