diff options
author | Santiago M. Mola <santi@mola.io> | 2017-07-27 17:17:34 +0200 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-08-01 13:01:59 +0200 |
commit | e5c6fa237776870483cbe227d7f7ea943f35cb12 (patch) | |
tree | d8708626c6e4bdacdf3d3b796a17025908b6606b /plumbing/format/config/section_test.go | |
parent | 1e70916ca7e4d5c0ad00edbfd1877e06d7587fc6 (diff) | |
download | go-git-e5c6fa237776870483cbe227d7f7ea943f35cb12.tar.gz |
config: preserve option order on config marshalling
Do not change order of options (e.g. in RemoteConfig)
when serializing for any option whose value has not changed.
Diffstat (limited to 'plumbing/format/config/section_test.go')
-rw-r--r-- | plumbing/format/config/section_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plumbing/format/config/section_test.go b/plumbing/format/config/section_test.go index cfd9f3f..0290386 100644 --- a/plumbing/format/config/section_test.go +++ b/plumbing/format/config/section_test.go @@ -69,3 +69,22 @@ func (s *SectionSuite) TestSubsection_RemoveOption(c *C) { } c.Assert(sect.RemoveOption("key1"), DeepEquals, expected) } + +func (s *SectionSuite) TestSubsection_SetOption(c *C) { + sect := &Subsection{ + Options: []*Option{ + {Key: "key1", Value: "value1"}, + {Key: "key2", Value: "value2"}, + {Key: "key1", Value: "value3"}, + }, + } + + expected := &Subsection{ + Options: []*Option{ + {Key: "key1", Value: "value1"}, + {Key: "key2", Value: "value2"}, + {Key: "key1", Value: "value4"}, + }, + } + c.Assert(sect.SetOption("key1", "value1", "value4"), DeepEquals, expected) +} |