public
Description: The Git TextMate Bundle
Homepage: http://tim.theenchanter.com/
Clone URL: git://github.com/timcharper/git-tmbundle.git
when assigning nil to the config command, tell git to unset the value
timcharper (author)
Thu Apr 10 16:18:48 -0700 2008
commit  553fda601a187789340a09ff37eee44bfc87f6fe
tree    d3ffdfb8fdb31535dd1e6b01e58534fe04f57fff
parent  5bd4176e0cc4664128ae6a582361b41a11833537
...
8
9
10
11
 
 
 
 
 
 
 
12
13
14
...
8
9
10
 
11
12
13
14
15
16
17
18
19
20
0
@@ -8,7 +8,13 @@ class SCM::Git::Config < SCM::Git::CommandProxyBase
0
   def []=(*params)
0
     value = params.pop
0
     scope, key = process_keys(params)
0
- base.command(*(["config"] + config_args(scope) + [key, value]))
0
+ args = ["config"] + config_args(scope)
0
+ if value
0
+ args += [key, value]
0
+ else
0
+ args += ["--unset", key]
0
+ end
0
+ base.command(*args)
0
   end
0
   
0
   protected
...
32
33
34
 
 
 
 
35
36
37
...
32
33
34
35
36
37
38
39
40
41
0
@@ -32,6 +32,10 @@ describe SCM::Git do
0
     Git.commands_ran.first.should == ["config", "--file", "/base/.git/config", "remote.origin.url", "../origin"]
0
   end
0
   
0
+ it "should delete local values when assigning nil" do
0
+ @git.config[:local, "git-tmbundle.log.limit"] = nil
0
+ Git.commands_ran.first.should == ["config", "--file", "/base/.git/config", "--unset", "git-tmbundle.log.limit"]
0
+ end
0
   
0
   it "should allow reading global values" do
0
     Git.command_response["config", "--global", "remote.origin.url"] = "../origin"

Comments

    No one has commented yet.