aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-01-10 16:23:53 +0100
committerJavi Fontan <jfontan@gmail.com>2018-01-10 16:23:53 +0100
commita4ea96f42e50368010f4b1656bef52e1f0f99190 (patch)
treea814d6ff16bb88dcf489dd1c8ac6eeb3b41e7218 /config
parent891459cb3c854851ce6fba860e5abb49621b4193 (diff)
downloadgo-git-a4ea96f42e50368010f4b1656bef52e1f0f99190.tar.gz
Make DefaultPackWindow const public and document it
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'config')
-rw-r--r--config/config.go10
-rw-r--r--config/config_test.go2
2 files changed, 7 insertions, 5 deletions
diff --git a/config/config.go b/config/config.go
index b5132ac..87a847d 100644
--- a/config/config.go
+++ b/config/config.go
@@ -70,7 +70,7 @@ func NewConfig() *Config {
Raw: format.New(),
}
- config.Pack.Window = defaultPackWindow
+ config.Pack.Window = DefaultPackWindow
return config
}
@@ -101,7 +101,9 @@ const (
worktreeKey = "worktree"
windowKey = "window"
- defaultPackWindow = uint(10)
+ // DefaultPackWindow holds the number of previous objects used to
+ // generate deltas. The value 10 is the same used by git command.
+ DefaultPackWindow = uint(10)
)
// Unmarshal parses a git-config file and stores it.
@@ -135,7 +137,7 @@ func (c *Config) unmarshalPack() error {
s := c.Raw.Section(packSection)
window := s.Options.Get(windowKey)
if window == "" {
- c.Pack.Window = defaultPackWindow
+ c.Pack.Window = DefaultPackWindow
} else {
winUint, err := strconv.ParseUint(window, 10, 32)
if err != nil {
@@ -196,7 +198,7 @@ func (c *Config) marshalCore() {
func (c *Config) marshalPack() {
s := c.Raw.Section(packSection)
- if c.Pack.Window != defaultPackWindow {
+ if c.Pack.Window != DefaultPackWindow {
s.SetOption(windowKey, fmt.Sprintf("%d", c.Pack.Window))
}
}
diff --git a/config/config_test.go b/config/config_test.go
index a5e804f..1f120c0 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -163,5 +163,5 @@ func (s *ConfigSuite) TestRemoteConfigDefaultValues(c *C) {
c.Assert(config.Remotes, HasLen, 0)
c.Assert(config.Submodules, HasLen, 0)
c.Assert(config.Raw, NotNil)
- c.Assert(config.Pack.Window, Equals, defaultPackWindow)
+ c.Assert(config.Pack.Window, Equals, DefaultPackWindow)
}