GitVersion: [Windows][Appveyor] InvalidSpecificationException: the given reference name '[branch]' is not valid

Version: 5.1.3

Really not sure what’s going on here, but after trying a few different things I’m stumped:

Calculating semantic version...
INFO [02/24/20 23:50:44:59] Working directory: C:\projects\octokit-net
INFO [02/24/20 23:50:44:59] IsDynamicGitRepository: False
INFO [02/24/20 23:50:44:61] Returning Project Root from DotGitDirectory: C:\projects\octokit-net\.git\ - C:\projects\octokit-net\
INFO [02/24/20 23:50:44:62] Running on Windows.
INFO [02/24/20 23:50:44:62] Applicable build agent found: 'AppVeyor'.
INFO [02/24/20 23:50:44:62] Branch from build environment: fully-qualified-refs-fix
INFO [02/24/20 23:50:44:62] Begin: Normalizing git directory for branch 'fully-qualified-refs-fix'
  INFO [02/24/20 23:50:44:65] One remote found (origin -> 'https://github.com/octokit/octokit.net.git').
  INFO [02/24/20 23:50:44:65] Fetching from remote 'origin' using the following refspecs: +refs/heads/*:refs/remotes/origin/*.
  INFO [02/24/20 23:50:44:98] Creating local branch fully-qualified-refs-fix pointing at 3204b734e94cf4f25891a3d0d29d607af5912076
  INFO [02/24/20 23:50:44:99] End: Normalizing git directory for branch 'fully-qualified-refs-fix' (Took: 365.39ms)
dotnet :   ERROR [02/24/20 23:50:45:01] An unexpected error occurred:
At line:1 char:1
+ dotnet run -- --configuration="Release" --linkSources="True" --dryrun ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (  ERROR [02/24/...error occurred::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
LibGit2Sharp.InvalidSpecificationException: the given reference name 'fully-qualified-refs-fix' is not valid
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.En
sure.ZeroResult(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_reference_create(RepositoryHandle repo, String name, ObjectId targetId, Boolean allowOverwrite, String logMessage)
   at LibGit2Sharp.ReferenceCollection.Add(String name, ObjectId targetId, String logMessage, Boolean allowOverwrite)
   at LibGit2Sharp.ReferenceCollection.Add(String name, ObjectId targetId)
   at GitVersion.Helpers.GitRepositoryHelper.EnsureLocalBranchExistsForCurrentBranch(ILog log, Repository repo, Remote remote, String currentBranch) in D:\a\1\s\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 171
   at GitVersion.Helpers.GitRepositoryHelper.NormalizeGitDirectory(ILog log, IEnvironment environment, String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch, Boolean isDynamicRepository) 
in D:\a\1\s\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 41
   at GitVersion.GitPreparer.NormalizeGitDirectory(AuthenticationInfo auth, String targetBranch, String gitDirectory, Boolean isDynamicRepository) in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 190
   at GitVersion.GitPreparer.Prepare(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 65
   at GitVersion.GitVersionCalculator.CalculateVersionVariables() in D:\a\1\s\src\GitVersionCore\GitVersionCalculator.cs:line 54
   at GitVersion.ExecCommand.Execute() in D:\a\1\s\src\GitVersionExe\ExecCommand.cs:line 40
   at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in D:\a\1\s\src\GitVersionExe\GitVersionExecutor.cs:line 117
  INFO [02/24/20 23:50:45:01] 
  INFO [02/24/20 23:50:45:01] Attempting to show the current git graph (please include in issue): 
  INFO [02/24/20 23:50:45:01] Showing max of 100 commits
  INFO [02/24/20 23:50:45:18] *   3204b734 3 minutes ago  (HEAD)
|\  
| * 9238e1dc 65 minutes ago 
|/  
* eee57895 2 hours ago  (origin/master, origin/HEAD, master)
* 5223d1af 2 hours ago 
* 6fdd800f 6 hours ago  (tag: v0.41.0)
* fe6639f2 9 hours ago 
| * 2bb02f26 23 hours ago  (origin/brave-new-codegen-world)
| * 746921f4 29 hours ago 
| * 314ef922 30 hours ago 
| * db522495 2 days ago 
| * 3dee4789 2 days ago 
| * 868c6689 2 days ago 
| * fc88eda0 2 days ago 
| * 15becc92 2 days ago 
| * 7c08319d 2 days ago 
| * 6f9f34b2 2 days ago 
| * 7f0d9316 2 days ago 
| * 45a37383 3 days ago 
| * 93f4697d 3 days ago 
| * 0325e61c 3 days ago 
| * 1693ffbf 3 days ago 
| * 413b118e 3 days ago 
| * 673e7343 3 days ago 
| * cd1088af 3 days ago 
| * 5c51bde4 3 days ago 
| * 0b5af237 3 days ago 
| * 85aba44e 3 days ago 
| * 33ddddcf 3 days ago 
| * 96098369 4 days ago 
| * 45672ad6 4 days ago 
| * 43530694 4 days ago 
| * ad309879 4 days ago 
| * dfdcc6ef 4 days ago 
| * 98495de3 4 days ago 
| * ddb35c15 4 days ago 
| * 40df2e92 4 days ago 
| * 9beb2e6d 4 days ago 
| * 4641f261 4 days ago 
| * 7384a561 4 days ago 
| * cb233046 4 days ago 
| * 498c2865 4 days ago 
| * 189aa1bf 5 days ago 
| * 6bb8b0e4 5 days ago 
|/  
* 0074e76a 6 days ago 
* 804aa483 13 days ago 
* 9f6de380 2 weeks ago 
* 2b2626be 2 weeks ago 
* 5de37916 2 weeks ago  (tag: v0.40.0)
* 736c3bd3 2 weeks ago 
| * 3edbcaac 2 weeks ago  (origin/bringing-windows-back)
|/  
* 8dac9688 2 weeks ago  (tag: v0.39.0)
* 8cf4d584 2 weeks ago 
* 911dd4a9 2 weeks ago 
* 9b136b1f 2 weeks ago 
* 26d770b2 2 weeks ago  (tag: v0.38.0)
* d4b86011 2 weeks ago 
* 56895ea6 3 weeks ago 
* 45621c0c 3 weeks ago 
* 2d0124f8 3 weeks ago 
* 321c9ba5 4 weeks ago  (tag: v0.37.0)
* 52902027 4 weeks ago 
* 03aa9089 4 weeks ago 
* 43ae40fa 4 weeks ago 
* e065c861 4 weeks ago 
* 44dc2a9e 4 weeks ago 
* bbae5190 4 weeks ago 
* 2431bb48 4 weeks ago 
* 39fb9f6a 4 weeks ago 
* d8e6008b 4 weeks ago 
* 8605b8cf 4 weeks ago 
* 7669dcbc 5 weeks ago 
* 28892df0 5 weeks ago 
* 00f60510 5 weeks ago 
* 6719e870 5 weeks ago 
* 95d4951f 5 weeks ago 
* e9409e0c 5 weeks ago 
* a05d49e8 3 months ago 
* fd6bca91 3 months ago 
* f61654a7 4 months ago 
* 5eb9f06b 4 months ago 
* 8b263cdc 4 months ago 
* 90812951 4 months ago 
* 311e89a5 5 months ago  (tag: v0.36.0)
* 3e7c70cf 5 months ago 
* ce5ea644 5 months ago  (tag: v0.35.0)
* aeb8d19f 5 months ago 
| * ac8ac6fa 5 months ago  (origin/management-console-authorized-ssh-keys)
| * 0c3fbeb5 5 months ago 
| * 92e3ca79 5 months ago 
| * 6719e5af 5 months ago 
| * 8efec609 5 months ago 
| * fb85a7a4 5 months ago 
| * 1e9079b5 5 months ago 
| * 4ef04e0a 5 months ago 
| * 1c6f70ad 5 months ago 
| * e08ac388 5 months ago 
| * 266b9a62 5 months ago 
| * 1415dc3b 5 months ago 
| * e0d5a74e 5 months ago 
| * 835e1573 5 months ago 

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 28 (14 by maintainers)

Most upvoted comments

I think the issue is that the branch contains refs in the name (all 3 attempts had that in the name)

Confirmed this is the issue (a new PR submitted without containing refs passes). Going to leave this open for a bit to remind myself to try and reproduce it in isolation and see if I can put something on the libgit2sharp tracker.

@asbjornu I’d like to figure out why it’s only failing on Windows too (as someone who has contributed to libgit2sharp before, I’d like to know why this is failing because it seems a bit absurd).