single commit and bumping go-git version

This commit is contained in:
zach rice committed 2019-02-06 09:26:41 -06:00
1 parent 3b45fb91e3
commit 15dedda59a
48 files changed
+1453 -390

No files matched your search

+7 -2
View File
@@ -155,7 +155,7 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) (err error) {
}
}
rs, err := pushHashes(ctx, s, r.s, req, hashesToPush)
rs, err := pushHashes(ctx, s, r.s, req, hashesToPush, r.useRefDeltas(ar))
if err != nil {
return err
}
@@ -167,6 +167,10 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) (err error) {
return r.updateRemoteReferenceStorage(req, rs)
}
func (r *Remote) useRefDeltas(ar *packp.AdvRefs) bool {
return !ar.Capabilities.Supports(capability.OFSDelta)
}
func (r *Remote) newReferenceUpdateRequest(
o *PushOptions,
localRefs []*plumbing.Reference,
@@ -994,6 +998,7 @@ func pushHashes(
s storage.Storer,
req *packp.ReferenceUpdateRequest,
hs []plumbing.Hash,
useRefDeltas bool,
) (*packp.ReportStatus, error) {
rd, wr := io.Pipe()
@@ -1004,7 +1009,7 @@ func pushHashes(
}
done := make(chan error)
go func() {
e := packfile.NewEncoder(wr, s, false)
e := packfile.NewEncoder(wr, s, useRefDeltas)
if _, err := e.Encode(hs, config.Pack.Window); err != nil {
done <- wr.CloseWithError(err)
return