diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-09-10 11:33:35 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2018-09-10 11:33:35 +0200 |
commit | bf0593d86ef73f28d3eb097c02d53a6a036f52f7 (patch) | |
tree | 2cfe20ab4b2ee85280aeabba40fd004d88e8b47f /plumbing/object/commit.go | |
parent | f8adfff71d844df7efa1367b7958e8f26411aaf9 (diff) | |
parent | a2d62f58ea626bb9f41de6431f6f18ca92cf78a0 (diff) | |
download | go-git-bf0593d86ef73f28d3eb097c02d53a6a036f52f7.tar.gz |
Merge branch 'master' of github.com:src-d/go-git into f-add-tagging-support
Diffstat (limited to 'plumbing/object/commit.go')
-rw-r--r-- | plumbing/object/commit.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go index 00ae3f1..e254342 100644 --- a/plumbing/object/commit.go +++ b/plumbing/object/commit.go @@ -199,17 +199,23 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) { } split := bytes.SplitN(line, []byte{' '}, 2) + + var data []byte + if len(split) == 2 { + data = split[1] + } + switch string(split[0]) { case "tree": - c.TreeHash = plumbing.NewHash(string(split[1])) + c.TreeHash = plumbing.NewHash(string(data)) case "parent": - c.ParentHashes = append(c.ParentHashes, plumbing.NewHash(string(split[1]))) + c.ParentHashes = append(c.ParentHashes, plumbing.NewHash(string(data))) case "author": - c.Author.Decode(split[1]) + c.Author.Decode(data) case "committer": - c.Committer.Decode(split[1]) + c.Committer.Decode(data) case headerpgp: - c.PGPSignature += string(split[1]) + "\n" + c.PGPSignature += string(data) + "\n" pgpsig = true } } else { |