func (s *shard) EnsureRepos() error { if err := btrfs.Ensure(s.dataRepo); err != nil { return err } if err := btrfs.Ensure(s.compRepo); err != nil { return err } return nil }
func (r *Runner) makeOutRepo(pipeline string) error { if err := btrfs.Ensure(path.Join(r.outPrefix, pipeline)); err != nil { return err } exists, err := btrfs.FileExists(path.Join(r.outPrefix, pipeline, r.branch)) if err != nil { return err } if !exists { // The branch doesn't exist, we need to create it We'll make our branch // have the same parent as the commit we're running off of if that // parent exists in the pipelines outRepo. This lets us carry over past // computation results when a new branch is created rather than having // to start from scratch. parent := btrfs.GetMeta(path.Join(r.inRepo, r.commit), "parent") if parent != "" { exists, err := btrfs.FileExists(path.Join(r.outPrefix, pipeline, parent)) if err != nil { return err } if !exists { parent = "" } } if err := btrfs.Branch(path.Join(r.outPrefix, pipeline), parent, r.branch); err != nil { return err } } // The branch exists, so we're ready to return return nil }