Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 package git | |
|
M-A Ruel
2014/10/18 00:47:04
Chromium Copyright.
iannucci
2014/10/20 21:11:56
Done.
| |
| 2 | |
| 3 // Blob is a git Object which represents file data | |
| 4 type Blob struct { | |
| 5 id ObjectID | |
| 6 data string | |
| 7 } | |
| 8 | |
| 9 func (b *Blob) ID() ObjectID { return b.id } | |
| 10 func (b *Blob) Type() string { return "blob" } | |
| 11 func (b *Blob) Complete() bool { return true } | |
| 12 func (b *Blob) RawString() string { return b.data } | |
| 13 | |
| 14 // BlobFromRaw creates a new *Blob, calculating the ID() from |data| | |
| 15 func BlobFromRaw(data []byte) *Blob { | |
| 16 return BlobFromRawWithID(MakeObjectIDForData("blob", data), data) | |
| 17 } | |
| 18 | |
| 19 // BlobFromRawWithID creates a new *Blob, trusting |id|. There is no verificatio n | |
| 20 // that |data| and |id| match. | |
| 21 func BlobFromRawWithID(id ObjectID, data []byte) *Blob { | |
| 22 return &Blob{id, string(data)} | |
| 23 } | |
| OLD | NEW |