From 56629c0a44888bc1cf74b756d7cd4f26407d601e Mon Sep 17 00:00:00 2001 From: Xiaoxuan Wang Date: Fri, 20 Oct 2023 05:06:39 +0000 Subject: [PATCH] final refinement before refector Signed-off-by: Xiaoxuan Wang --- content/oci/deletableoci.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/oci/deletableoci.go b/content/oci/deletableoci.go index b1098aa9b..dadd584c8 100644 --- a/content/oci/deletableoci.go +++ b/content/oci/deletableoci.go @@ -127,15 +127,17 @@ func (ds *DeletableStore) Delete(ctx context.Context, target ocispec.Descriptor) defer ds.lock.Unlock() resolvers := ds.tagResolver.Map() + untagged := false for reference, desc := range resolvers { if content.Equal(desc, target) { ds.tagResolver.Untag(reference) + untagged = true } } if err := ds.graph.Remove(ctx, target); err != nil { return err } - if ds.AutoSaveIndex { + if untagged && ds.AutoSaveIndex { err := ds.saveIndex() if err != nil { return err