Unmarshal parses a git-config file and stores it.
(b []byte)
| 47 | |
| 48 | // Unmarshal parses a git-config file and stores it. |
| 49 | func (m *Modules) Unmarshal(b []byte) error { |
| 50 | r := bytes.NewBuffer(b) |
| 51 | d := format.NewDecoder(r) |
| 52 | |
| 53 | m.raw = format.New() |
| 54 | if err := d.Decode(m.raw); err != nil { |
| 55 | return err |
| 56 | } |
| 57 | |
| 58 | unmarshalSubmodules(m.raw, m.Submodules) |
| 59 | return nil |
| 60 | } |
| 61 | |
| 62 | // Marshal returns Modules encoded as a git-config file. |
| 63 | func (m *Modules) Marshal() ([]byte, error) { |