Skip to content

Commit

Permalink
Sort the DB names found in multirepo env
Browse files Browse the repository at this point in the history
  • Loading branch information
macneale4 committed May 18, 2023
1 parent f15fcc0 commit 48f1778
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions go/libraries/doltcore/env/multi_repo_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"unicode"

Expand Down Expand Up @@ -138,8 +139,14 @@ func MultiEnvForDirectory(
delete(envSet, dbName)
}

for dbName, env := range envSet {
mrEnv.addEnv(dbName, env)
// get the keys from the envSet keys as a sorted list
sortedKeys := make([]string, 0, len(envSet))
for k := range envSet {
sortedKeys = append(sortedKeys, k)
}
sort.Strings(sortedKeys)
for _, dbName := range sortedKeys {
mrEnv.addEnv(dbName, envSet[dbName])
}

return mrEnv, nil
Expand Down

0 comments on commit 48f1778

Please sign in to comment.