Skip to content
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

"Not a valid refspec" error during build with a specific configured remote.x.fetch refspec #256

Closed
kkm000 opened this issue Mar 22, 2019 · 3 comments · Fixed by #288
Closed
Labels

Comments

@kkm000
Copy link

kkm000 commented Mar 22, 2019

  • Package version 1.0.0-beta2-18618-05, currently latest.
  • VS 15.9.9
  • Git version 2.16.2.windows.1

Both net45 and netstandard1.3 targets behave identically.

I have the following fragment in .git/config setting up fetched branches from remotes:

[remote "golden"]
        url = git://github.com/grpc/grpc.git
        fetch = +refs/heads/master:refs/remotes/golden/master
        fetch = +refs/heads/v1.17.x:refs/remotes/golden/v1.17.x
[remote "origin"]
        url = ssh://github.com/kkm000/grpc.git
        fetch = +refs/heads/kkm/*:refs/remotes/origin/kkm/*
        fetch = +refs/heads/package-*:refs/remotes/origin/package-*

When I attempt to build the project, I am getting the following error (split in 2 lines for the ease of reading):

C:\Users\kkm\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(28,5):
 error : '+refs/heads/package-*:refs/remotes/origin/package-*' is not a valid refspec.

Naturally, when I disable the last fetch line in the above snippet, build succeeds.

Git does not object to this refspec, and the version I have is not quite even the latest; in fact, the configuration has been there for a very long time. The Microsoft.Build.Tasks.Git may have been updated upstream, though (I just came back to work on this project after a few month long hiatus).

I hope I've provided enough info, but please @ me if more is required!

@tmat
Copy link
Member

tmat commented Apr 22, 2019

I can reproduce. Seems like a difference in behavior between libgit2 and git.

Seems like libgit2 expects refspecs to end with /* and this one does not:

  fetch = +refs/heads/package-*:refs/remotes/origin/package-*

Seems like a bug in libgit2: libgit2/libgit2#5058.

@tmat
Copy link
Member

tmat commented Apr 22, 2019

Keeping the issue open to update libgit2 once it has the fix.

@tmat
Copy link
Member

tmat commented Jun 22, 2019

Fixed by #288

@tmat tmat closed this as completed Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants