Skip to content

Commit 457cdce

Browse files
committed
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.
1 parent 8026fc2 commit 457cdce

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/integration/tests/branch/checkout_by_name.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{
99
Description: "Try to checkout branch by name. Verify that it also works on the branch with the special name @.",
1010
ExtraCmdArgs: []string{},
1111
Skip: false,
12-
SetupConfig: func(config *config.AppConfig) {},
12+
SetupConfig: func(config *config.AppConfig) {
13+
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
14+
},
1315
SetupRepo: func(shell *Shell) {
1416
shell.
1517
CreateNCommits(3).

pkg/integration/tests/branch/delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
1111
Skip: false,
1212
SetupConfig: func(config *config.AppConfig) {
1313
config.GetUserConfig().Git.LocalBranchSortOrder = "recency"
14+
config.GetUserConfig().Git.RemoteBranchSortOrder = "alphabetical"
1415
},
1516
SetupRepo: func(shell *Shell) {
1617
shell.

0 commit comments

Comments
 (0)