@@ -64,11 +64,15 @@ type Config struct {
6464
6565// NewConfig returns a new empty Config.
6666func NewConfig () * Config {
67- return & Config {
67+ config := & Config {
6868 Remotes : make (map [string ]* RemoteConfig ),
6969 Submodules : make (map [string ]* Submodule ),
7070 Raw : format .New (),
7171 }
72+
73+ config .Pack .Window = DefaultPackWindow
74+
75+ return config
7276}
7377
7478// Validate validates the fields and sets the default values.
@@ -97,7 +101,9 @@ const (
97101 worktreeKey = "worktree"
98102 windowKey = "window"
99103
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 )
101107)
102108
103109// Unmarshal parses a git-config file and stores it.
@@ -131,7 +137,7 @@ func (c *Config) unmarshalPack() error {
131137 s := c .Raw .Section (packSection )
132138 window := s .Options .Get (windowKey )
133139 if window == "" {
134- c .Pack .Window = defaultPackWindow
140+ c .Pack .Window = DefaultPackWindow
135141 } else {
136142 winUint , err := strconv .ParseUint (window , 10 , 32 )
137143 if err != nil {
@@ -192,7 +198,7 @@ func (c *Config) marshalCore() {
192198
193199func (c * Config ) marshalPack () {
194200 s := c .Raw .Section (packSection )
195- if c .Pack .Window != defaultPackWindow {
201+ if c .Pack .Window != DefaultPackWindow {
196202 s .SetOption (windowKey , fmt .Sprintf ("%d" , c .Pack .Window ))
197203 }
198204}
0 commit comments