Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit a4ea96f

Browse files
committed
Make DefaultPackWindow const public and document it
Signed-off-by: Javi Fontan <jfontan@gmail.com>
1 parent 891459c commit a4ea96f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

config/config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func NewConfig() *Config {
7070
Raw: format.New(),
7171
}
7272

73-
config.Pack.Window = defaultPackWindow
73+
config.Pack.Window = DefaultPackWindow
7474

7575
return config
7676
}
@@ -101,7 +101,9 @@ const (
101101
worktreeKey = "worktree"
102102
windowKey = "window"
103103

104-
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)
105107
)
106108

107109
// Unmarshal parses a git-config file and stores it.
@@ -135,7 +137,7 @@ func (c *Config) unmarshalPack() error {
135137
s := c.Raw.Section(packSection)
136138
window := s.Options.Get(windowKey)
137139
if window == "" {
138-
c.Pack.Window = defaultPackWindow
140+
c.Pack.Window = DefaultPackWindow
139141
} else {
140142
winUint, err := strconv.ParseUint(window, 10, 32)
141143
if err != nil {
@@ -196,7 +198,7 @@ func (c *Config) marshalCore() {
196198

197199
func (c *Config) marshalPack() {
198200
s := c.Raw.Section(packSection)
199-
if c.Pack.Window != defaultPackWindow {
201+
if c.Pack.Window != DefaultPackWindow {
200202
s.SetOption(windowKey, fmt.Sprintf("%d", c.Pack.Window))
201203
}
202204
}

config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,5 @@ func (s *ConfigSuite) TestRemoteConfigDefaultValues(c *C) {
163163
c.Assert(config.Remotes, HasLen, 0)
164164
c.Assert(config.Submodules, HasLen, 0)
165165
c.Assert(config.Raw, NotNil)
166-
c.Assert(config.Pack.Window, Equals, defaultPackWindow)
166+
c.Assert(config.Pack.Window, Equals, DefaultPackWindow)
167167
}

0 commit comments

Comments
 (0)