Skip to content

Issue Running on AppVeyor #284

@gep13

Description

@gep13

I have just run into an issue when running on AppVeyor:

https://ci.appveyor.com/project/GaryEwanPark/webapisample/build/1.0.29#L99

Here is the output from GitVersion:

Applicable build agent found: 'AppVeyor'.
One remote found (origin -> 'git://github.com/gep13/WebApiSample.git').
Fetching from remote 'origin' using the following refspecs: +refs/heads/*:refs/remotes/origin/*.
Creating local branch from remote tracking 'refs/remotes/origin/HEAD'.
Creating local branch from remote tracking 'refs/remotes/origin/ProblemWithUpdate'.
Skipping local branch creation since it already exists 'refs/remotes/origin/develop'.
Creating local branch from remote tracking 'refs/remotes/origin/feature/Issue-4'.
Creating local branch from remote tracking 'refs/remotes/origin/master'.
HEAD is detached and points at commit '5e9a9b04f45269ec8593871396989d9524500f1f'.
An error occurred:
Found more than one local branch pointing at the commit 5e9a9b04f45269ec8593871396989d9524500f1f'. Unable to determine which one to use (refs/heads/develop, refs/heads/HEAD).
Working directory: C:\projects\WebApiSample
Applicable build agent found: 'AppVeyor'.
One remote found (origin -> 'git://github.com/gep13/WebApiSample.git').
Fetching from remote 'origin' using the following refspecs: +refs/heads/*:refs/remotes/origin/*.
Creating local branch from remote tracking 'refs/remotes/origin/HEAD'.
Creating local branch from remote tracking 'refs/remotes/origin/ProblemWithUpdate'.
Skipping local branch creation since it already exists 'refs/remotes/origin/develop'.
Creating local branch from remote tracking 'refs/remotes/origin/feature/Issue-4'.
Creating local branch from remote tracking 'refs/remotes/origin/master'.
HEAD is detached and points at commit '5e9a9b04f45269ec8593871396989d9524500f1f'.
An error occurred:
Found more than one local branch pointing at the commit '5e9a9b04f45269ec8593871396989d9524500f1f'. Unable to determine which one to use (refs/heads/develop, refs/heads/HEAD).

The error message is coming from here:

https://github.com/Particular/GitVersion/blob/master/GitVersionCore/BuildServers/GitHelper.cs#L46

Which was added by me, to allow support in AppVeyor when building a Pull Request, and some branches were missing. While working on the ChocolateyGUI project, this has been working perfectly. I have just started using the same approach on another project, and things aren't working.

The difference on this project is the PR's are coming from the same repo, rather than from a remote. I had a quick chat with @nulltoken about this:

https://twitter.com/nulltoken/status/526291881270202368

And his suggestion is:

I think we shouldn't recreate remote HEAD branch (when it exists) as a local one

And points at this code:

https://github.com/Particular/GitVersion/blob/master/GitVersionCore/BuildServers/GitHelper.cs#L172-L196

I am going to take a look at this soon, but I just wanted to place this here in case anyone gets to this first.

Any pointers on exactly what is required I would welcome, and I will get it tested out and create a PR for the fix.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions