Open dazinator opened 9 years ago
Updating remotes looks like this:
var repo = new FluentRepo()
.Load(GitRepoPath)
.UpdateRemote(r => r.Name == "fluentgit",
u =>
u.ChangeUrlTo("https://github.com/libgit2/libgit2sharp.git")
.ChangeRefSpecs()
.Add("+refs/heads/master:refs/remotes/fluentgit/master")
// can alternatively use RefSpecBuilder to build refspec strings:
.Add(b =>
b.Source("refs/heads/master")
.Destination("refs/other/fluentgit/master")
.ForceUpdateIfFastForwardNotPossible())
.AddIfNotExists("+refs/heads/*:refs/remotes/fluentgit/*")
.Remove("+refs/heads/somebranch:refs/remotes/somebranch"))
.UpdateRemoteIfExists(r => r.Url == "non existing url",
u =>
// as the remote doesn't exist in this case, none of the below updates will execute.
u.ChangeUrlTo("http://someurl.com")
.ChangeRefSpecs()
.Add("+whatever/*:whatever/*")
.Remove("+blah/*:blah/*"));
Fluent API should allow:
Iterating all remotes.done.Creating new remotes.done.Updating an existing remote.done.refspecs
for(done)Fetch
andPush
commands that are subsequently done against the remote. This ties in with #3