aboutsummaryrefslogtreecommitdiffstats
path: root/core/memory.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-08-29 22:39:08 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-29 22:39:08 +0200
commit5cf20a4edf7803458a1c2ec94e902369bed76f28 (patch)
treeb6a0276ab12f82383818892064038fb0b79e161b /core/memory.go
parenta97ca42cbce377b5725ecc41e4539fc7e263b90d (diff)
downloadgo-git-5cf20a4edf7803458a1c2ec94e902369bed76f28.tar.gz
object: Add Encode method to all objects. (#70)
Encode method encodes a typed object (commit, tree, tag, blob) into raw core.Object representation. Additionally, Decode does not trim commit message lines. This is needed for Decode/Encode to be idempotent.
Diffstat (limited to 'core/memory.go')
-rw-r--r--core/memory.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/memory.go b/core/memory.go
index 3d8063d..8826966 100644
--- a/core/memory.go
+++ b/core/memory.go
@@ -50,6 +50,7 @@ func (o *MemoryObject) Writer() (ObjectWriter, error) {
func (o *MemoryObject) Write(p []byte) (n int, err error) {
o.cont = append(o.cont, p...)
+ o.sz = int64(len(o.cont))
return len(p), nil
}