aboutsummaryrefslogtreecommitdiffstats
path: root/config/config.go
diff options
context:
space:
mode:
authorManuel Carmona <manu.carmona90@gmail.com>2017-08-10 09:34:47 +0200
committerManuel Carmona <manu.carmona90@gmail.com>2017-08-10 09:34:47 +0200
commit0f8ed5664c38605fbb849017214cebbf5de50666 (patch)
tree55831dd4b0ce3e16fe1717a5033c7dfdc4ad1888 /config/config.go
parentda410ded51ddab7729992540b54c739e43090244 (diff)
downloadgo-git-0f8ed5664c38605fbb849017214cebbf5de50666.tar.gz
serialized remotes in alphabetical order
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/config/config.go b/config/config.go
index cb10738..475045e 100644
--- a/config/config.go
+++ b/config/config.go
@@ -5,6 +5,7 @@ import (
"bytes"
"errors"
"fmt"
+ "sort"
format "gopkg.in/src-d/go-git.v4/plumbing/format/config"
)
@@ -168,9 +169,16 @@ func (c *Config) marshalRemotes() {
}
}
- for name, remote := range c.Remotes {
+ remoteNames := make([]string, 0, len(c.Remotes))
+ for name := range c.Remotes {
+ remoteNames = append(remoteNames, name)
+ }
+
+ sort.Strings(remoteNames)
+
+ for _, name := range remoteNames {
if !added[name] {
- newSubsections = append(newSubsections, remote.marshal())
+ newSubsections = append(newSubsections, c.Remotes[name].marshal())
}
}