How do I set multiple values for a config-key
This is indeed a currently missing feature in LibGit2Sharp. An issue has just been opened to track this.
However, if what you're after is setting/updating the default refspecs of a remote, the repo.Network.Remotes.Update()
method may already fit that need without having to wait for the issue to be fixed.
- Pull request #567 recently enhanced the
Remotes.Update()
method to make it cope with refspecs updation. As such, your example could be fulfilled with the following code.
var fetchSpecs = new string[]
{
"+refs/heads/master:refs/remotes/origin/master",
"+refs/heads/qa/*:refs/remotes/origin/qa/*"
};
using (var repo = new Repository(path))
{
var remote = repo.Network.Remotes["origin"];
repo.Network.Remotes.Update(remote, r => r.FetchRefSpecs = fetchSpecs);
}
- More or less related, pull request #553 introduced an easy way to enumerate all the refspecs of a remote