From 457cdce61d62c6d6cbe6b185d4d0dda005ecd287 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 9 Jul 2025 15:37:47 +0200 Subject: [PATCH] Fix unstable tests Now that -committerdate is the default sort order, we could get different results for the sort order of the branches list depending on whether the commits on both branches have the same committer time stamp (likely in an integration test, since git time stamps have second resolution), in which case git will fall back to alphabetical order, or not (rare, but possible), in which case master will have the newer commit and will come first. Make this stable by forcing the sort order to alphabetical. We might have more tests with this problem, we'll just have to fix them one by one as we see them fail. --- pkg/integration/tests/branch/checkout_by_name.go | 4 +++- pkg/integration/tests/branch/delete.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/integration/tests/branch/checkout_by_name.go b/pkg/integration/tests/branch/checkout_by_name.go index af06162a7..949730c30 100644 --- a/pkg/integration/tests/branch/checkout_by_name.go +++ b/pkg/integration/tests/branch/checkout_by_name.go @@ -9,7 +9,9 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Try to checkout branch by name. Verify that it also works on the branch with the special name @.", ExtraCmdArgs: []string{}, Skip: false, - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical" + }, SetupRepo: func(shell *Shell) { shell. CreateNCommits(3). diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go index 5da844622..2e6a19c2e 100644 --- a/pkg/integration/tests/branch/delete.go +++ b/pkg/integration/tests/branch/delete.go @@ -11,6 +11,7 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{ Skip: false, SetupConfig: func(config *config.AppConfig) { config.GetUserConfig().Git.LocalBranchSortOrder = "recency" + config.GetUserConfig().Git.RemoteBranchSortOrder = "alphabetical" }, SetupRepo: func(shell *Shell) { shell.