func (b *LsObjectsBuiltin) Execute(p *Params, args []string) { b.Parse(args) args = b.Args() var ( diskRepo *api.DiskRepository err error ) // make sure this is a disk repo if diskRepo, err = api.AssertDiskRepo(p.Repo); err != nil { fmt.Fprintf(p.Werr, err.Error()) return } var ( oids []*objects.ObjectId e error ) if b.flagLoose { oids, e = diskRepo.LooseObjectIds() } else if b.flagPacked { oids, e = diskRepo.PackedObjectIds() } else { oids, e = api.ObjectIds(diskRepo) } if e != nil { fmt.Fprintf(p.Werr, "Error: %s\n", e.Error()) return } printAll(p, oids) }
func (b *VerifyPackedObjectsBuiltin) Execute(p *Params, args []string) { var repo *api.DiskRepository switch t := p.Repo.(type) { case *api.DiskRepository: repo = t default: fmt.Fprintf(p.Werr, "verify-packed-objects applies only to DiskRepository; found: %s", t) return } objects, e := repo.PackedObjects() if e != nil { fmt.Fprintf(p.Werr, "Error: %s\n", e.Error()) return } for i := range objects { object := objects[i] base := "" if oid := object.DeltaOf; oid != nil { base = fmt.Sprintf("base %s depth %d", oid, object.Depth) } fmt.Fprintln(p.Wout, object.Object().ObjectId(), object.Object().Header().Type(), base) } }