Parse AddRoot hunk
Dependencies
- [2]
CSP3ROTUBetter testing infrastructure - [3]
6GDPWAD2Parse Unhashed and Contents of Change - [4]
7VEHGTEYSwitch from reading text format to reading binary format. - [*]
EVHNGDT7parse FileAdd hunk - [*]
PHRWK7NKParse change headers - [*]
4JWXOJIPParse dependencies
Change contents
- edit in hunk.go at line 191
case 11:return addRoot(data) - edit in hunk.go at line 228
}type AddRoot struct {Name AtomInode Atom}func (AddRoot) isHunk() {}func addRoot(data []byte) ([]byte, AddRoot, error) {var a AddRootdata, _, err := tuple(assign(&a.Name, atom),assign(&a.Inode, atom),)(data)return data, a, err - edit in change_test.go at line 15
//go:embed testdata/DSPWN6DOSXQ3IIPW2JNOLFP32C7SQTSQZ7BBSEGA4UWNXQXNMS6AC.changevar DSPWN6 []byte//go:embed testdata/MRE2H23UNRCHMZIKISVB4T7DTDDVVK7DCCSLFEMXOXLLQNQVELGAC.changevar MRE2H2 []byte - edit in change_test.go at line 25
text string - edit in change_test.go at line 108
{hash: "DSPWN6DOSXQ3IIPW2JNOLFP32C7SQTSQZ7BBSEGA4UWNXQXNMS6AC",data: DSPWN6,parsed: Change{Version: 6,Message: "",Timestamp: time.Date(2023, 3, 29, 23, 24, 28, 233348937, time.UTC),Authors: []map[string]string{},Dependencies: []Hash{},ExtraKnown: []Hash{},Metadata: []byte{},Changes: []Hunk{AddRoot{Name: NewVertex{UpContext: []Position{{Change: OptionalHash{true, Hash{}},Pos: 0,},},DownContext: []Position{},Flag: 17,Start: 0,End: 0,Inode: Position{Change: OptionalHash{true, Hash{}},Pos: 0,},},Inode: NewVertex{UpContext: []Position{{Change: OptionalHash{},Pos: 0,},},DownContext: []Position{},Flag: 17,Start: 1,End: 1,Inode: Position{Change: OptionalHash{true, Hash{}},Pos: 0,},},},},ContentsHash: mustHashFromBase32("QXZAPGWPXKVFMHB5UIIYKF4K2STXSWH3RPLXVTR5WR6HKSERFVOAC"),Contents: []byte{0xfa, 0x7b, 0xfe, 0x96, 0x61, 0x6e, 0x0a, 0xa1, 0x6b, 0x40, 0x73, 0xa6, 0x99, 0xf8, 0xbb, 0x8c,0x15, 0x35, 0xc9, 0x3f, 0x6f, 0xfc, 0x8f, 0x4b, 0x72, 0xd8, 0xa9, 0x1d, 0xd4, 0xde, 0x7f, 0x86,},},text: `message = ''timestamp = '2023-03-29T23:24:28.233348937Z'authors = []# Hunks1. Root addup 1.0, new 0:0`,}, - edit in change.go at line 53[8.1701][8.1701]
}func mustHashFromBase32(b32 string) Hash {h, err := HashFromBase32(b32)if err != nil {panic(err)}return h - replacement in change.go at line 104
err = json.Unmarshal(unhashed, &c.Unhashed)if err != nil {return Change{}, errif len(unhashed) > 0 {err = json.Unmarshal(unhashed, &c.Unhashed)if err != nil {return Change{}, fmt.Errorf("error parsing unhashed contents (%q): %w", unhashed, err)} - edit in .ignore at line 3[7.1921]
sandbox