diff --git a/metadata/adaptors.go b/metadata/adaptors.go index 5c6983be2..b165c38e0 100644 --- a/metadata/adaptors.go +++ b/metadata/adaptors.go @@ -159,9 +159,7 @@ func adaptSnapshot(info snapshots.Info) filters.Adaptor { case "name": return info.Name, true case "parent": - if info.Parent != "" { - return info.Parent, true - } + return info.Parent, true case "labels": return checkMap(fieldpath[1:], info.Labels) } diff --git a/snapshots/storage/bolt.go b/snapshots/storage/bolt.go index 062ba6815..712c71f72 100644 --- a/snapshots/storage/bolt.go +++ b/snapshots/storage/bolt.go @@ -633,9 +633,7 @@ func adaptSnapshot(info snapshots.Info) filters.Adaptor { case "name": return info.Name, true case "parent": - if info.Parent != "" { - return info.Parent, true - } + return info.Parent, true case "labels": if len(info.Labels) == 0 { return "", false diff --git a/snapshots/testsuite/testsuite.go b/snapshots/testsuite/testsuite.go index 63f7eb711..11ebfdc1d 100644 --- a/snapshots/testsuite/testsuite.go +++ b/snapshots/testsuite/testsuite.go @@ -1061,7 +1061,7 @@ func checkWalk(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshot }, { matches: []string{"a", "v", "a-wl", "v-wl"}, - filters: []string{"parent,labels.\"containerd.io/gc.root\"==check-walk"}, + filters: []string{"parent!=\"\",labels.\"containerd.io/gc.root\"==check-walk"}, }, { matches: []string{"p-wl", "a-wl", "v-wl", "a-np-wl"},