Explicitely specify supersedes for new index

This commit is contained in:
Alexander Neumann
2016-08-15 20:49:01 +02:00
parent 29bb845f0e
commit 8d735cf6a9
2 changed files with 14 additions and 15 deletions
+11 -11
View File
@@ -180,22 +180,22 @@ func (cmd CmdPrune) Execute(args []string) error {
return err
}
id, err := idx.Save(repo)
var supersedes backend.IDs
for idxID := range repo.List(backend.Index, done) {
err := repo.Backend().Remove(backend.Index, idxID.String())
if err != nil {
fmt.Fprintf(os.Stderr, "unable to remove index %v: %v\n", idxID.Str(), err)
}
supersedes = append(supersedes, idxID)
}
id, err := idx.Save(repo, supersedes)
if err != nil {
return err
}
cmd.global.Verbosef("saved new index as %v\n", id.Str())
for oldIndex := range repo.List(backend.Index, done) {
if id.Equal(oldIndex) {
continue
}
err := repo.Backend().Remove(backend.Index, oldIndex.String())
if err != nil {
fmt.Fprintf(os.Stderr, "unable to remove index %v: %v\n", oldIndex.Str(), err)
}
}
cmd.global.Verbosef("done\n")
return nil
}