Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/command/stack: fix faulty sort for sorting stacks #5212

Merged
merged 1 commit into from
Jul 1, 2024

Commits on Jul 1, 2024

  1. cli/command/stack: fix faulty sort for sorting stacks

    This code was updated in 7b9580d, which
    removed support for using kubernetes as orchestrator, but in doing so
    made this `sort.Slice` (probably) not do what it was expected to do ':)
    
        index 412cc2e5ee86..861ae1be2fb9 100644
        @@ -75,8 +54,7 @@ func format(dockerCli command.Cli, opts options.List, orchestrator command.Orche
            }
            sort.Slice(stacks, func(i, j int) bool {
                return sortorder.NaturalLess(stacks[i].Name, stacks[j].Name) ||
        -            !sortorder.NaturalLess(stacks[j].Name, stacks[i].Name) &&
        -            sortorder.NaturalLess(stacks[j].Namespace, stacks[i].Namespace)
        +            !sortorder.NaturalLess(stacks[j].Name, stacks[i].Name)
            })
            return formatter.StackWrite(stackCtx, stacks)
         }
    
    The extra condition was added in 84241cc
    to support multiple namespaces. This patch removes it, bringing it back to
    the state it was before that commit.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    be14edc View commit details
    Browse the repository at this point in the history