Handle both types of root directory
Dependencies
- [2]
FWGMIVUZAdd tijo-cat command - [3]
EYPCPIP7Apply changes and build a graph - [*]
7D7CMNN3Handle Edit hunks
Change contents
- edit in pristine.go at line 72[5.592][3.1044]
if change == (Hash{}) {return g.Root} - replacement in pristine.go at line 254
b := g.Rootfor i := 0; i < 2; i++ {var next *Blockfor _, e := range b.Edges {if e.Flag&EdgeFlagsDeleted != 0 {// There are two possible configurations for the directory structure:// The old setup had directory entries as direct children of the root.// The new setup has a special root inode, which is a child of an intermediate// vertex, which is a child of the root.//// So we need to try both possibilities.var possibleRoots []*Blockvar directFiles []*Blockfor _, e := range g.Root.Edges {if e.Flag&EdgeFlagsDeleted != 0 {continue}if e.Flag&EdgeFlagsFolder == 0 {return nil, errors.New("non-folder edge found while looking for root directory")}b := e.Toif len(b.Content) > 0 {directFiles = append(directFiles, b)continue}for _, f := range b.Edges {if f.Flag&EdgeFlagsDeleted != 0 { - replacement in pristine.go at line 278
if e.Flag&EdgeFlagsFolder == 0 {if f.Flag&EdgeFlagsFolder == 0 { - replacement in pristine.go at line 281
next = e.Tobreakif len(f.To.Content) > 0 {continue}possibleRoots = append(possibleRoots, f.To) - edit in pristine.go at line 286
if next == nil {return nil, errors.New("no root directory found")}b = next - replacement in pristine.go at line 288
return b, nilif len(directFiles) > 0 || len(possibleRoots) == 0 {return g.Root, nil}if len(possibleRoots) > 1 {return nil, fmt.Errorf("found %d possible root directories", len(possibleRoots))}return possibleRoots[0], nil