`mc rm --non-current should remove top level deletemarker (#4037)
Earlier commit #8eae2e3bbfafe952ecb33904c0d9073871a32169 reverted this behavior, bringing it back Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
This commit is contained in:
co-authored by
Poorna Krishnamoorthy
parent
dc2a851b54
commit
3e39ece950
+4
-4
@@ -159,7 +159,8 @@ EXAMPLES:
|
||||
13. Remove all object versions older than one year.
|
||||
{{.Prompt}} {{.HelpName}} s3/docs/ --recursive --versions --rewind 365d
|
||||
|
||||
14. Perform a fake removal of object(s) versions that are non-current and older than 10 days.
|
||||
14. Perform a fake removal of object(s) versions that are non-current and older than 10 days. If top-level version is a delete
|
||||
marker, this will also be deleted when --non-current flag is specified.
|
||||
{{.Prompt}} {{.HelpName}} s3/docs/ --recursive --force --versions --non-current --older-than 10d --dry-run
|
||||
`,
|
||||
}
|
||||
@@ -398,7 +399,6 @@ func listAndRemove(url string, opts removeOpts) error {
|
||||
listOpts.WithDeleteMarkers = true
|
||||
listOpts.TimeRef = opts.timeRef
|
||||
}
|
||||
|
||||
atLeastOneObjectFound := false
|
||||
|
||||
resultCh := clnt.Remove(ctx, opts.isIncomplete, isRemoveBucket, opts.isBypass, contentCh)
|
||||
@@ -436,7 +436,7 @@ func listAndRemove(url string, opts removeOpts) error {
|
||||
if lastPath != content.URL.Path {
|
||||
lastPath = content.URL.Path
|
||||
for _, content := range perObjectVersions {
|
||||
if content.IsLatest {
|
||||
if content.IsLatest && !content.IsDeleteMarker {
|
||||
continue
|
||||
}
|
||||
if !content.Time.IsZero() {
|
||||
@@ -547,7 +547,7 @@ func listAndRemove(url string, opts removeOpts) error {
|
||||
|
||||
if opts.nonCurrentVersion && opts.isRecursive && opts.withVersions {
|
||||
for _, content := range perObjectVersions {
|
||||
if content.IsLatest {
|
||||
if content.IsLatest && !content.IsDeleteMarker {
|
||||
continue
|
||||
}
|
||||
if !content.Time.IsZero() {
|
||||
|
||||
Reference in New Issue
Block a user