-
Notifications
You must be signed in to change notification settings - Fork 654
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
track-merge-target in branch config not working #1789
Comments
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions. |
Can anybody help with this? |
Sorry, but you may have stumbled across a bug here. If you are able to submit a pull request that fixes the bug, we will of course merge it, but I don't have time to look at this anytime soon, I'm afraid. |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions. |
Maybe don't let it auto-close and track this as a bug so it might get implemented someday in the future? |
@rose-a The only way we can get this one fixed is when someone will send us a PR we can review and merge, unfortunately we don't have too much time to fix it so a PR from your side it welcomed. |
@arturcic yeah I get that, no pressure... but just letting it go stale and auto-close won't fix things... don't know how you can tell your stale bot to leave it alone, maybe by adding a |
Thanks for this issue, I have also been looking for quite some time for a tool that supports GitLab Flow. Can someone point us in the right direction where we have to take a look?
I'm not experienced in C#, but are we looking at the Line 29 in e1b4534
|
I think I am hitting the same problem... I am testing the behavior locally with:
TestDevelop & TestRelease are on 3.0.0 and I then merge a new commit from TestDevelop into TestRelease branch with a merge commit (no-ff). Then I tag the merge commit with a new version number 3.1.0 According to the doc:
I was expecting TestDevelop to start from 3.1.0 at this point, but adding another new commit to TestDevelop and run gitversion still give me 3.0.1, which, didn't seem to honor the tag on the merge commit. Did I just misunderstand the doc or it's indeed a bug? @asbjornu is there any insight you can share on this? I am more than happy to submit a PR to fix it if you can point me to a start point. |
Does the behaviour change if you remove |
This may be related to #3190. It may also be worth trying to change the configuration so |
Please see the discussion in #3052. I would like to fix this issue and know for sure (like you already said) that the track-merge-target is without function. This feature has replaced with an implicit logic wish full-fill the requirement at least for the gitflow workflow. But I agree it would be nice to support all workflows and give you the possibility to make it configurable like you want. |
In TrackReleaseBranchesVersionStrategy.cs you find the following logic: private IEnumerable<BaseVersion> MainTagsVersions()
{
var configuration = this.context.Value.Configuration.Configuration;
var main = this.repositoryStore.FindMainBranch(configuration);
return main != null
? this.taggedCommitVersionStrategy.GetTaggedVersions(main, null)
: Array.Empty<BaseVersion>();
} That means with this strategy the tagged version will be determined from the main branch. The question is how the code detects the main branch? public IBranch? FindMainBranch(Config configuration)
{
var mainBranchRegex = configuration.Branches[Config.MainBranchKey]?.Regex
?? configuration.Branches[Config.MasterBranchKey]?.Regex;
if (mainBranchRegex == null)
{
return FindBranch(Config.MainBranchKey) ?? FindBranch(Config.MasterBranchKey);
}
return this.repository.Branches.FirstOrDefault(b =>
Regex.IsMatch(b.Name.Friendly, mainBranchRegex, RegexOptions.IgnoreCase));
} The answer is it is hard coded with the magic string main and master. If we change the logic that we detect the main branch using the existing BranchConfiguration.IsMainline property it would give you the possibility to make it configurable. I'm just wondering if it is possible to have more than one main branches? What about support branch? |
Actually I like the idea to have a pre-defined workflow template which can be versioned and changed without affecting other workflows. |
Yep, sure.
I suppose so. I believe a branch being considered main only affects itself and its own versioning strategy. I don't think other branches should be affected by one or more branches being configured as main. |
Except that the TrackReleaseBranchesVersionStrategy class works not only on the current branch. It tries to get the tagged version explicit from the main or master branch configuration. My suggestion would be each of the following variants:
What do you think? |
Sorry, I got a bit confused there for a moment. The Now, being a mainline branch is not the same as being a main branch, as all of the different workflows have a main branch in some form or another. In those, it may make sense to have more than one main branch – I don't really know. Either way, in other workflows than I know this is confusing, but that's where we are. It would probably be better to have a typed configuration system that was wholly dependent on |
Okay if I understand you correct we have branches with the property IsMainline=true for:
Is this correct? I'm just wonder what a trunkbase workflow makes so special that we need a dedicated VersioningMode for that and if this is really import for this issue. At the end to come back to the problem of the author it is just important to detect the tagged commits on branches which are marked with IsMainline=true independent of its name. |
Afaik, yes.
Good question. I'm not sure, to be honest. I've never used
From my understanding, |
🎉 This issue has been resolved in version 6.0.0-beta.1 🎉 Your GitReleaseManager bot 📦🚀 |
I'm trying to create a GitVersion config for GitLab Flow.
In GitLab Flow master is effectively the development branch and the production branch resembles master in Git Flow.
Since GitLab allows the automatic creation of issue branches from within its GUI (branch name starting with the GitLab issue number), I created a new branch type for them borrowing the feature branch config.
The resulting config looks like this:
The one thing which is currently not working is
track-merge-target: true
on the master branch config, which, according to the docs should do the following:So with the provided config I would expect master → merge into production and tag 1.0.0 to result in master incrementing to 1.1.0 on the next commit.
Do I understand the intention of the
track-merge-target
setting correctly?PS: Trying to understand the behaviour from the source code I stumbled upon the following:
So basically the setting is read but never used! Is this feature actually implemented?
The text was updated successfully, but these errors were encountered: