Skip to content

Skip creation of HEAD branch when creating local branches #286

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

Merged
merged 1 commit into from
Oct 27, 2014

Conversation

gep13
Copy link
Member

@gep13 gep13 commented Oct 27, 2014

@gep13
Copy link
Member Author

gep13 commented Oct 27, 2014

This relates to the issue which was raised here #284

@nulltoken, can you take a look and let me know what you think?

If I have understood the problem, then I have simply done a very simple check to ensure that the HEAD branch isn't created locally.

I have created a "hooky" version of GitVersion and installed on AppVeyor, and it certainly seems to work. You can see the output of the build here:

https://ci.appveyor.com/project/GaryEwanPark/webapisample/build/0.2.0-unstable.23+23%20(Build%2034)

NOTE Yes, I like foxes, I name all my branches suffixed with Fox, this was in no way a typo :-)

@@ -176,6 +176,13 @@ static void CreateMissingLocalBranchesFromRemoteTrackingOnes(Repository repo, st
foreach (var remoteTrackingReference in repo.Refs.FromGlob(prefix + "*"))
{
var localCanonicalName = "refs/heads/" + remoteTrackingReference.CanonicalName.Substring(prefix.Length);

if (localCanonicalName.EndsWith("HEAD"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather see an explicit equality check here rather than an "ends with".

Couldn't you first build up the expected HEAD canonical name (eg. 'refs/remotes/' + remoteName + '/HEAD') and suppress it from the foreach enumeration through a negative .Where() call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yip, that makes sense. Will take a look at lunch time 👍

@gep13
Copy link
Member Author

gep13 commented Oct 27, 2014

@nulltoken I have implemented your suggestion, and it works as expected.

Build working here:

https://ci.appveyor.com/project/GaryEwanPark/webapisample/build/0.2.0-unstable.25+25%20(Build%2036)

Thoughts?

@nulltoken
Copy link
Contributor

@gep13 You rock!

nitpick: i'd recommend to squash the two commits as they relate to the same logical change

orherwise 👍 for me. @JakeGinnivan @SimonCropp ?

@JakeGinnivan
Copy link
Contributor

expectedRemoteHeadCanonicalName confuses me, could drop expected from that variable name?

Otherwise looks good

@gep13 gep13 force-pushed the FurtherAppVeyorFox branch from c852fc6 to c3d25d3 Compare October 27, 2014 15:55
@gep13
Copy link
Member Author

gep13 commented Oct 27, 2014

nitpick: i'd recommend to squash the two commits as they relate to the same logical change

Done

- Based on a suggestion from @nulltoken, skipping the creation of the HEAD branch, if it exists in the list of branches to create.
- This was causing an issue when running on AppVeyor
- This can be seen working here:
	https://ci.appveyor.com/project/GaryEwanPark/webapisample/build/0.2.0-unstable.23+23%20(Build%2034)
@gep13 gep13 force-pushed the FurtherAppVeyorFox branch from c3d25d3 to 0bc9155 Compare October 27, 2014 15:57
@gep13
Copy link
Member Author

gep13 commented Oct 27, 2014

expectedRemoteHeadCanonicalName confuses me, could drop expected from that variable name?

Done

@gep13 gep13 mentioned this pull request Oct 27, 2014
@SimonCropp SimonCropp added this to the 1.4.0 milestone Oct 27, 2014
SimonCropp added a commit that referenced this pull request Oct 27, 2014
Skip creation of HEAD branch when creating local branches
@SimonCropp SimonCropp merged commit c67f155 into GitTools:master Oct 27, 2014
@gep13
Copy link
Member Author

gep13 commented Oct 27, 2014

Sweet!

Do you know when you are planning the next release?

Sent from my Windows Phone


From: Simon Croppmailto:[email protected]
Sent: ‎27/‎10/‎2014 21:45
To: Particular/GitVersionmailto:[email protected]
Cc: Gary Ewan Parkmailto:[email protected]
Subject: Re: [GitVersion] Skip creation of HEAD branch when creating local branches (#286)

Merged #286.


Reply to this email directly or view it on GitHub:
#286 (comment)

@SimonCropp
Copy link
Contributor

i dumped it in 1.4. prob on the weekend.

@gep13
Copy link
Member Author

gep13 commented Oct 27, 2014

Cool, no immediate rush, just curious about timescale. I will use my hooky copy for now :-)

Sent from my Windows Phone


From: Simon Croppmailto:[email protected]
Sent: ‎27/‎10/‎2014 21:50
To: Particular/GitVersionmailto:[email protected]
Cc: Gary Ewan Parkmailto:[email protected]
Subject: Re: [GitVersion] Skip creation of HEAD branch when creating local branches (#286)

i dumped it in 1.4. prob on the weekend.


Reply to this email directly or view it on GitHub:
#286 (comment)

@gep13
Copy link
Member Author

gep13 commented Nov 2, 2014

@SimonCropp just wanted to touch base on this. Are you pushing a new release this weekend? Or will it be later? Just wanted to know whether I can get rid of my hooky copy. Thanks!

@SimonCropp
Copy link
Contributor

done. it is still the weekend somewhere right?

@gep13
Copy link
Member Author

gep13 commented Nov 2, 2014

done. it is still the weekend somewhere right?

It is quickly running out here in the UK :-P

I have just approved the package on Chocolatey.org, so it is good to go :-)

@gep13 gep13 deleted the FurtherAppVeyorFox branch February 24, 2016 19:52
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

Successfully merging this pull request may close these issues.

4 participants