-
Notifications
You must be signed in to change notification settings - Fork 654
Fix tracking branches in dynamic repositories #464
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
Fix tracking branches in dynamic repositories #464
Conversation
…n using a dynamic repository
Is this still happening on the V3 beta branch, or is this only on v2? |
I tried this on master (97dade8), which is ahead of 3.0.0-Beta3 |
Just to confirm, the 3.0.0 release hasn't been merged yet: https://github.com/ParticularLabs/GitVersion/tree/release/3.0.0 Can you try on this? |
Sorry, I don't understand, running |
To the best of my knowledge, although I hadn't checked, the beta code hasn't been merged to master, but I could be wrong. @JakeGinnivan could confirm. You could well be right, and I am just a little behind 😸 |
Yeah, GitHub also says that release/3.0.0 is 0 commits ahead of master and 4 commits behind it :-) |
Sorry for confusion, I am just using release branch for releasing betas. Am keeping master in sync/ahead Sent from my Windows Phone From: Johannes Eggermailto:[email protected] I tried this on master (97dade897dade8), which is ahead of 3.0.0-Beta3 — |
Ping @nulltoken, thoughts on the libgit2sharp question? |
@JakeGinnivan Thanks for the ping! @eggapauli Could you please elaborate further regarding what makes you think that? |
I was wrong. I think the problem was that a local ref was added, but it wasn't set up to track the remote ref. |
@@ -203,6 +205,9 @@ static void CreateMissingLocalBranchesFromRemoteTrackingOnes(Repository repo, st | |||
{ | |||
repo.Refs.Add(localCanonicalName, new ObjectId(symbolicReference.ResolveToDirectReference().TargetIdentifier), true); | |||
} | |||
|
|||
var branch = repo.Branches[branchName]; | |||
repo.Branches.Update(branch, b => b.TrackedBranch = remoteTrackingReferenceName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would GV be run on a development environment, this would blindly overwrite the potentially existing tracking configuration for every considered branch. Is this expected?
/cc @JakeGinnivan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these statements are only executed for newly created branches, otherwise they are skipped due to the if statement in line 192.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, this normalisation code should only ever happen on the build server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even without that if statement which was highlighted. Are there any other scenarios this could happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(other than normalisation)
…repo Fix tracking branches in dynamic repositories
When running GitVersion with a dynamic repository using a new branch it cannot find a remote tracking branch. I dug a bit deeper and found that in
GitHelper.CreateMissingLocalBranchesFromRemoteTrackingOnes
theremoteTrackingReference
is aDirectReference
, but I think it should be aSymbolicReference
for this to work.I'm not sure how to fix this as I'm not familiar with LibGit2Sharp. Any advice?