func loadIndex(m *Model) { fname := fmt.Sprintf("%x.idx.gz", sha1.Sum([]byte(m.Dir()))) idxf, err := os.Open(path.Join(opts.ConfDir, fname)) if err != nil { return } defer idxf.Close() gzr, err := gzip.NewReader(idxf) if err != nil { return } defer gzr.Close() idx, err := protocol.ReadIndex(gzr) if err != nil { return } m.SeedIndex(idx) }
func loadIndex(m *model.Model) { name := m.RepoID() + ".idx.gz" idxf, err := os.Open(path.Join(opts.ConfDir, name)) if err != nil { return } defer idxf.Close() gzr, err := gzip.NewReader(idxf) if err != nil { return } defer gzr.Close() idx, err := protocol.ReadIndex(gzr) if err != nil { return } m.SeedLocal(idx) }