@@ -64,11 +64,15 @@ type Config struct {
64
64
65
65
// NewConfig returns a new empty Config.
66
66
func NewConfig () * Config {
67
- return & Config {
67
+ config := & Config {
68
68
Remotes : make (map [string ]* RemoteConfig ),
69
69
Submodules : make (map [string ]* Submodule ),
70
70
Raw : format .New (),
71
71
}
72
+
73
+ config .Pack .Window = DefaultPackWindow
74
+
75
+ return config
72
76
}
73
77
74
78
// Validate validates the fields and sets the default values.
@@ -97,7 +101,9 @@ const (
97
101
worktreeKey = "worktree"
98
102
windowKey = "window"
99
103
100
- defaultPackWindow = uint (10 )
104
+ // DefaultPackWindow holds the number of previous objects used to
105
+ // generate deltas. The value 10 is the same used by git command.
106
+ DefaultPackWindow = uint (10 )
101
107
)
102
108
103
109
// Unmarshal parses a git-config file and stores it.
@@ -131,7 +137,7 @@ func (c *Config) unmarshalPack() error {
131
137
s := c .Raw .Section (packSection )
132
138
window := s .Options .Get (windowKey )
133
139
if window == "" {
134
- c .Pack .Window = defaultPackWindow
140
+ c .Pack .Window = DefaultPackWindow
135
141
} else {
136
142
winUint , err := strconv .ParseUint (window , 10 , 32 )
137
143
if err != nil {
@@ -192,7 +198,7 @@ func (c *Config) marshalCore() {
192
198
193
199
func (c * Config ) marshalPack () {
194
200
s := c .Raw .Section (packSection )
195
- if c .Pack .Window != defaultPackWindow {
201
+ if c .Pack .Window != DefaultPackWindow {
196
202
s .SetOption (windowKey , fmt .Sprintf ("%d" , c .Pack .Window ))
197
203
}
198
204
}
0 commit comments