Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 package git | |
|
M-A Ruel
2014/10/21 00:55:53
you need to keep an empty line, otherwise it is co
iannucci
2016/05/23 21:53:42
oh, yikes, ok
| |
| 5 | |
| 6 // Blob is a git Object which represents file data | |
| 7 type Blob struct { | |
| 8 id ObjectID | |
| 9 data string | |
|
M-A Ruel
2014/10/21 00:55:53
So you really use string here as []byte. I think I
iannucci
2016/05/23 21:53:42
Well... most blobs /are/ human readable (usually t
| |
| 10 } | |
| 11 | |
| 12 func (b *Blob) ID() ObjectID { return b.id } | |
| 13 func (b *Blob) Type() ObjectType { return BlobType } | |
| 14 func (b *Blob) Complete() bool { return true } | |
| 15 func (b *Blob) RawString() string { return b.data } | |
| 16 | |
| 17 // BlobFromRaw creates a new *Blob, calculating the ID() from |data| | |
| 18 func BlobFromRaw(data []byte) *Blob { | |
| 19 return BlobFromRawWithID(MakeObjectIDForData(BlobType, data), data) | |
| 20 } | |
| 21 | |
| 22 // BlobFromRawWithID creates a new *Blob, trusting |id|. There is no verificatio n | |
|
M-A Ruel
2014/10/21 00:55:53
Generally I personally ensure these docstrings are
iannucci
2016/05/23 21:53:42
Done.
| |
| 23 // that |data| and |id| match. | |
| 24 func BlobFromRawWithID(id ObjectID, data []byte) *Blob { | |
| 25 return &Blob{id, string(data)} | |
| 26 } | |
| OLD | NEW |