@@ -46,18 +46,18 @@ type Config struct {
46
46
// of the submodule, should equal to Submodule.Name.
47
47
Submodules map [string ]* Submodule
48
48
49
- // contains the raw information of a config file, the main goal is preserve
50
- // the parsed information from the original format, to avoid missing
51
- // unsupported features .
52
- raw * format.Config
49
+ // Raw contains the raw information of a config file. The main goal is
50
+ // preserve the parsed information from the original format, to avoid
51
+ // dropping unsupported fields .
52
+ Raw * format.Config
53
53
}
54
54
55
55
// NewConfig returns a new empty Config.
56
56
func NewConfig () * Config {
57
57
return & Config {
58
58
Remotes : make (map [string ]* RemoteConfig , 0 ),
59
59
Submodules : make (map [string ]* Submodule , 0 ),
60
- raw : format .New (),
60
+ Raw : format .New (),
61
61
}
62
62
}
63
63
@@ -91,8 +91,8 @@ func (c *Config) Unmarshal(b []byte) error {
91
91
r := bytes .NewBuffer (b )
92
92
d := format .NewDecoder (r )
93
93
94
- c .raw = format .New ()
95
- if err := d .Decode (c .raw ); err != nil {
94
+ c .Raw = format .New ()
95
+ if err := d .Decode (c .Raw ); err != nil {
96
96
return err
97
97
}
98
98
@@ -102,7 +102,7 @@ func (c *Config) Unmarshal(b []byte) error {
102
102
}
103
103
104
104
func (c * Config ) unmarshalCore () {
105
- s := c .raw .Section (coreSection )
105
+ s := c .Raw .Section (coreSection )
106
106
if s .Options .Get (bareKey ) == "true" {
107
107
c .Core .IsBare = true
108
108
}
@@ -111,7 +111,7 @@ func (c *Config) unmarshalCore() {
111
111
}
112
112
113
113
func (c * Config ) unmarshalRemotes () error {
114
- s := c .raw .Section (remoteSection )
114
+ s := c .Raw .Section (remoteSection )
115
115
for _ , sub := range s .Subsections {
116
116
r := & RemoteConfig {}
117
117
if err := r .unmarshal (sub ); err != nil {
@@ -125,7 +125,7 @@ func (c *Config) unmarshalRemotes() error {
125
125
}
126
126
127
127
func (c * Config ) unmarshalSubmodules () {
128
- s := c .raw .Section (submoduleSection )
128
+ s := c .Raw .Section (submoduleSection )
129
129
for _ , sub := range s .Subsections {
130
130
m := & Submodule {}
131
131
m .unmarshal (sub )
@@ -141,15 +141,15 @@ func (c *Config) Marshal() ([]byte, error) {
141
141
c .marshalSubmodules ()
142
142
143
143
buf := bytes .NewBuffer (nil )
144
- if err := format .NewEncoder (buf ).Encode (c .raw ); err != nil {
144
+ if err := format .NewEncoder (buf ).Encode (c .Raw ); err != nil {
145
145
return nil , err
146
146
}
147
147
148
148
return buf .Bytes (), nil
149
149
}
150
150
151
151
func (c * Config ) marshalCore () {
152
- s := c .raw .Section (coreSection )
152
+ s := c .Raw .Section (coreSection )
153
153
s .SetOption (bareKey , fmt .Sprintf ("%t" , c .Core .IsBare ))
154
154
155
155
if c .Core .Worktree != "" {
@@ -158,7 +158,7 @@ func (c *Config) marshalCore() {
158
158
}
159
159
160
160
func (c * Config ) marshalRemotes () {
161
- s := c .raw .Section (remoteSection )
161
+ s := c .Raw .Section (remoteSection )
162
162
s .Subsections = make (format.Subsections , len (c .Remotes ))
163
163
164
164
var i int
@@ -169,7 +169,7 @@ func (c *Config) marshalRemotes() {
169
169
}
170
170
171
171
func (c * Config ) marshalSubmodules () {
172
- s := c .raw .Section (submoduleSection )
172
+ s := c .Raw .Section (submoduleSection )
173
173
s .Subsections = make (format.Subsections , len (c .Submodules ))
174
174
175
175
var i int
0 commit comments