Skip to content

Commit dfb5c7f

Browse files
committed
git/config.go: correct comments and reorder funcs
We do some minor housekeeping to correct and clarify comments which didn't match their find/set/unset functions, and we move one function so we have a consistent ordering within each type.
1 parent 02f92e2 commit dfb5c7f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

git/config.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (c *Configuration) Find(val string) string {
6565
return output
6666
}
6767

68-
// FindGlobal returns the git config value global scope for the key
68+
// FindGlobal returns the git config value in global scope for the key
6969
func (c *Configuration) FindGlobal(key string) string {
7070
output, _ := c.gitConfig("--global", key)
7171
return output
@@ -77,7 +77,7 @@ func (c *Configuration) FindSystem(key string) string {
7777
return output
7878
}
7979

80-
// Find returns the git config value for the key
80+
// FindLocal returns the git config value in local scope for the key
8181
func (c *Configuration) FindLocal(key string) string {
8282
output, _ := c.gitConfig("--local", key)
8383
return output
@@ -93,6 +93,11 @@ func (c *Configuration) SetSystem(key, val string) (string, error) {
9393
return c.gitConfigWrite("--system", "--replace-all", key, val)
9494
}
9595

96+
// SetLocal sets the git config value for the key in the specified config file
97+
func (c *Configuration) SetLocal(key, val string) (string, error) {
98+
return c.gitConfigWrite("--replace-all", key, val)
99+
}
100+
96101
// UnsetGlobalSection removes the entire named section from the global config
97102
func (c *Configuration) UnsetGlobalSection(key string) (string, error) {
98103
return c.gitConfigWrite("--global", "--remove-section", key)
@@ -103,16 +108,11 @@ func (c *Configuration) UnsetSystemSection(key string) (string, error) {
103108
return c.gitConfigWrite("--system", "--remove-section", key)
104109
}
105110

106-
// UnsetLocalSection removes the entire named section from the system config
111+
// UnsetLocalSection removes the entire named section from the local config
107112
func (c *Configuration) UnsetLocalSection(key string) (string, error) {
108113
return c.gitConfigWrite("--local", "--remove-section", key)
109114
}
110115

111-
// SetLocal sets the git config value for the key in the specified config file
112-
func (c *Configuration) SetLocal(key, val string) (string, error) {
113-
return c.gitConfigWrite("--replace-all", key, val)
114-
}
115-
116116
// UnsetLocalKey removes the git config value for the key from the specified config file
117117
func (c *Configuration) UnsetLocalKey(key string) (string, error) {
118118
return c.gitConfigWrite("--unset", key)

0 commit comments

Comments
 (0)