Expose Push progress reporting#537
Conversation
There was a problem hiding this comment.
Could you please update the xml doc as well?
|
Thank you @nulltoken for the review. Updated. |
There was a problem hiding this comment.
Sorry, I overlooked this earlier, but I think this param is no longer needed (neither is its xml documentation)
|
One last nitpick, the following test doesn't pass. Is this because of the timer that had been added in libgit2 (BTW, could you add some xml doc on the handlers that are affected by this timer?) or because not all the transports invoke the transfer callback? [Fact]
public void CanReportDuringPushing()
{
string remoteRepoPath = InitNewRepository(true);
Commit commit;
using (var localRepo = new Repository(BareTestRepoPath))
{
commit = localRepo.Head.Tip;
Remote remote = localRepo.Network.Remotes.Add("origin", remoteRepoPath);
localRepo.Branches.Update(localRepo.Head,
b => b.Remote = remote.Name,
b => b.UpstreamBranch = localRepo.Head.CanonicalName);
bool builderCallbackCalled = false;
bool transferCallbackCalled = false;
var pushOptions = new PushOptions
{
OnPackBuilderProgress = (stage, current, total) =>
{
builderCallbackCalled = true;
return true;
},
OnPushTransferProgress = (current, total, bytes) =>
{
transferCallbackCalled = true;
return true;
}
};
localRepo.Network.Push(localRepo.Head, pushOptions: pushOptions);
Assert.Equal(true, builderCallbackCalled);
Assert.Equal(true, transferCallbackCalled);
}
using (var remoteRepo = new Repository(remoteRepoPath))
{
Assert.Equal(commit, remoteRepo.Head.Tip);
}
} |
|
Thanks! I updated the documentation on the
This is because not all transports invoke the transfer callback (in this case, the local transport does not invoke the transfer callback). This is why I didn't include test coverage for the transfer progress callback originally (but did include a test that the packbuilder callback was invoked). We could add this to libgit2 and then update the test here when we take the corresponding update. |
|
....98.....99....100% Merged! 💖 💥 |
@jamill I've kept track of this in libgit2/libgit2#1902 |
Expose push progress reporting and cancellation that was recently included in libgit2.