public
Description: The Git TextMate Bundle
Homepage: http://tim.theenchanter.com/
Clone URL: git://github.com/timcharper/git-tmbundle.git
renamed submodule stash to submodule "cache"
timcharper (author)
Tue Apr 29 18:23:03 -0700 2008
commit  a0a2dd806c8fc61e64c79fc6bc41923ddf6cc9f2
tree    2d365873389368624a46ba3b313256ce206207a6
parent  f02ee2ff4262c4ca37a3c68af012a0dcf474e339
...
77
78
79
80
 
81
82
83
...
147
148
149
150
 
151
152
153
...
77
78
79
 
80
81
82
83
...
147
148
149
 
150
151
152
153
0
@@ -77,7 +77,7 @@ class BranchController < ApplicationController
0
     puts "<h2>Merging #{@merge_from_branch} into #{@c_branch}</h2>"
0
     flush
0
     
0
- with_submodule_stashing do
0
+ with_submodule_cacheing do
0
       @result = git.merge(@merge_from_branch)
0
       render "merge"
0
       true
0
@@ -147,7 +147,7 @@ class BranchController < ApplicationController
0
     end
0
     
0
     def switch_local(target_branch)
0
- with_submodule_stashing do
0
+ with_submodule_cacheing do
0
         output = git.branch.switch(target_branch)
0
         case output
0
         when /fatal: you need to resolve your current index first/
...
48
49
50
51
 
52
53
54
...
48
49
50
 
51
52
53
54
0
@@ -48,7 +48,7 @@ class RemoteController < ApplicationController
0
       
0
       puts "<p>Pulling from remote source '#{source}'\n</p>"
0
       
0
- with_submodule_stashing do
0
+ with_submodule_cacheing do
0
         output = run_pull(source, remote_branch_name)
0
         puts "<pre>#{output[:text]}</pre>"
0
       
...
1
2
3
4
 
 
5
6
7
...
1
2
 
 
3
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 module SubmoduleHelper
0
   module Update
0
- def with_submodule_stashing(&block)
0
- git.submodule.all.each { |m| m.stash }
0
+ def with_submodule_cacheing(&block)
0
+ git.submodule.all.each { |m| m.cache }
0
       begin
0
         yield
0
       ensure
...
50
51
52
53
54
 
 
55
56
57
58
59
60
61
 
62
63
64
65
 
 
 
66
67
68
69
70
71
 
72
73
 
74
75
76
...
50
51
52
 
 
53
54
55
56
57
58
59
60
 
61
62
 
 
 
63
64
65
66
67
68
69
70
 
71
72
 
73
74
75
76
0
@@ -50,27 +50,27 @@ class SCM::Git::Submodule < SCM::Git::CommandProxyBase
0
       path
0
     end
0
     
0
- def abs_stash_path
0
- @abs_stash_path ||= File.join(@base.git_base, ".git/submodule_stash", MD5.hexdigest(path + "\n" + url))
0
+ def abs_cache_path
0
+ @abs_cache_path ||= File.join(@base.git_base, ".git/submodule_cache", MD5.hexdigest(path + "\n" + url))
0
     end
0
     
0
     def abs_path
0
       @abs_path ||= File.join(@base.git_base, @path)
0
     end
0
     
0
- def stash
0
+ def cache
0
       if File.exist?(abs_path)
0
- FileUtils.rm_rf(abs_stash_path)
0
- FileUtils.mkdir_p(File.dirname(abs_stash_path))
0
- FileUtils.mv(abs_path, abs_stash_path, :force => true)
0
+ FileUtils.rm_rf(abs_cache_path)
0
+ FileUtils.mkdir_p(File.dirname(abs_cache_path))
0
+ FileUtils.mv(abs_path, abs_cache_path, :force => true)
0
         true
0
       end
0
     end
0
     
0
     def restore
0
- if ! File.exist?(abs_path) && File.exist?(abs_stash_path)
0
+ if ! File.exist?(abs_path) && File.exist?(abs_cache_path)
0
         FileUtils.mkdir_p(File.dirname(abs_path))
0
- FileUtils.mv(abs_stash_path, abs_path, :force => true)
0
+ FileUtils.mv(abs_cache_path, abs_path, :force => true)
0
       end
0
     end
0
   end
...
88
89
90
91
 
92
93
94
95
 
96
97
98
...
148
149
150
151
152
 
 
153
154
155
...
88
89
90
 
91
92
93
94
 
95
96
97
98
...
148
149
150
 
 
151
152
153
154
155
0
@@ -88,11 +88,11 @@ EOF
0
       end
0
       
0
       describe "when you have submodules" do
0
- it "should stash, restore, then call submodules.init_and_update" do
0
+ it "should cache, restore, then call submodules.init_and_update" do
0
           @set_branch_to_choose.call("task")
0
           
0
           git = Git.singleton_new
0
- @submodule = stub("submodule", :stash => true, :restore => true)
0
+ @submodule = stub("submodule", :cache => true, :restore => true)
0
           git.submodule.should_receive(:all).any_number_of_times.and_return([@submodule])
0
           git.submodule.should_receive(:init_and_update)
0
           output = capture_output do
0
@@ -148,8 +148,8 @@ EOF
0
         output.should include("Success!")
0
       end
0
       
0
- it "should run with_submodule_stashing" do
0
- @controller.should_receive(:with_submodule_stashing)
0
+ it "should run with_submodule_cacheing" do
0
+ @controller.should_receive(:with_submodule_cacheing)
0
         capture_output { dispatch(:controller => "branch", :action => "merge") }
0
       end
0
     end
...
67
68
69
70
71
 
 
72
73
74
...
67
68
69
 
 
70
71
72
73
74
0
@@ -67,8 +67,8 @@ describe RemoteController do
0
       @output.should include("Branch 'asdf': dc29d3d..05f9ad9")
0
     end
0
     
0
- it "should with_submodule_stashing" do
0
- @controller.should_receive(:with_submodule_stashing)
0
+ it "should with_submodule_cacheing" do
0
+ @controller.should_receive(:with_submodule_cacheing)
0
       capture_output { dispatch :controller => "remote", :action => "pull" }
0
     end
0
   end
...
57
58
59
60
 
61
62
63
64
65
 
 
 
 
66
67
68
69
70
 
71
72
 
73
74
75
...
57
58
59
 
60
61
 
 
 
 
62
63
64
65
66
67
68
69
 
70
71
 
72
73
74
75
0
@@ -57,19 +57,19 @@ EOF
0
       @submodule.stub!(:url).and_return("git@url.com/path/to/repo.git")
0
     end
0
     
0
- it "should stash" do
0
+ it "should cache" do
0
       File.should_receive(:exist?).with(@submodule.abs_path).and_return(true)
0
- FileUtils.should_receive(:mkdir_p).with(File.join(@git.git_base, ".git/submodule_stash"))
0
- FileUtils.should_receive(:rm_rf).with(@submodule.abs_stash_path)
0
- FileUtils.should_receive(:mv).with(@submodule.abs_path, @submodule.abs_stash_path, :force => true)
0
- @submodule.stash
0
+ FileUtils.should_receive(:mkdir_p).with(File.join(@git.git_base, ".git/submodule_cache"))
0
+ FileUtils.should_receive(:rm_rf).with(@submodule.abs_cache_path)
0
+ FileUtils.should_receive(:mv).with(@submodule.abs_path, @submodule.abs_cache_path, :force => true)
0
+ @submodule.cache
0
     end
0
     
0
     it "should restore when submodule isn't in working copy" do
0
       File.should_receive(:exist?).with(@submodule.abs_path).and_return(false)
0
- File.should_receive(:exist?).with(@submodule.abs_stash_path).and_return(true)
0
+ File.should_receive(:exist?).with(@submodule.abs_cache_path).and_return(true)
0
       FileUtils.should_receive(:mkdir_p).with(File.dirname(@submodule.abs_path))
0
- FileUtils.should_receive(:mv).with(@submodule.abs_stash_path, @submodule.abs_path, :force => true)
0
+ FileUtils.should_receive(:mv).with(@submodule.abs_cache_path, @submodule.abs_path, :force => true)
0
       @submodule.restore
0
     end
0
   end

Comments

    No one has commented yet.