aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-02-27 15:34:06 +0100
committerAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-02-27 18:01:32 +0100
commit9a469de36eee1eb07c460b9d8c27c3ba5fe8e06e (patch)
treea69f35d28c9c2c36341a2d87b50ab128bf7ef868 /remote.go
parent39f43b52a2bdfbc73703e2d09b575d49cd70ede8 (diff)
downloadgo-git-9a469de36eee1eb07c460b9d8c27c3ba5fe8e06e.tar.gz
plumbing/revlist: input as a slice of hashes instead of commits
- Now the input of the method Objects inside revlist package is a slice of hashes instead of commits. Hashes can be from Blobs, Trees and Commits objects. - ObjectStorer now is used to obtain the object content using hashes slice. - This PR fix #222. Now a test into upload_pack_test.go file is not skipped anymore. - Remove code from remote.go and server.go that is not necessary.
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/remote.go b/remote.go
index a51946b..fe7993c 100644
--- a/remote.go
+++ b/remote.go
@@ -8,7 +8,6 @@ import (
"srcd.works/go-git.v4/config"
"srcd.works/go-git.v4/plumbing"
"srcd.works/go-git.v4/plumbing/format/packfile"
- "srcd.works/go-git.v4/plumbing/object"
"srcd.works/go-git.v4/plumbing/protocol/packp"
"srcd.works/go-git.v4/plumbing/protocol/packp/capability"
"srcd.works/go-git.v4/plumbing/protocol/packp/sideband"
@@ -97,7 +96,7 @@ func (r *Remote) Push(o *PushOptions) (err error) {
return NoErrAlreadyUpToDate
}
- commits, err := commitsToPush(r.s, req.Commands)
+ objects, err := objectsToPush(req.Commands)
if err != nil {
return err
}
@@ -107,7 +106,7 @@ func (r *Remote) Push(o *PushOptions) (err error) {
return err
}
- hashesToPush, err := revlist.Objects(r.s, commits, haves)
+ hashesToPush, err := revlist.Objects(r.s, objects, haves)
if err != nil {
return err
}
@@ -476,22 +475,17 @@ func (r *Remote) buildFetchedTags(refs storer.ReferenceStorer) error {
})
}
-func commitsToPush(s storer.EncodedObjectStorer, commands []*packp.Command) ([]*object.Commit, error) {
- var commits []*object.Commit
+func objectsToPush(commands []*packp.Command) ([]plumbing.Hash, error) {
+ var objects []plumbing.Hash
for _, cmd := range commands {
if cmd.New == plumbing.ZeroHash {
continue
}
- c, err := object.GetCommit(s, cmd.New)
- if err != nil {
- return nil, err
- }
-
- commits = append(commits, c)
+ objects = append(objects, cmd.New)
}
- return commits, nil
+ return objects, nil
}
func referencesToHashes(refs storer.ReferenceStorer) ([]plumbing.Hash, error) {