public
Description: The Git TextMate Bundle
Homepage: http://tim.theenchanter.com/
Clone URL: git://github.com/timcharper/git-tmbundle.git
auto-expand relative paths passed into Git#status
timcharper (author)
Wed Jun 11 11:20:35 -0700 2008
commit  f38a24bd4e0b8c6b7a0c6e441442a1eba9141e5a
tree    8c40008c09d3ccead6c192b62bd0a0d2167f5df7
parent  88a65a9691512df8f77fbddec937cd5c477866fa
...
206
207
208
209
210
211
212
213
214
 
 
215
216
217
...
206
207
208
 
209
210
211
212
 
213
214
215
216
217
0
@@ -206,12 +206,12 @@ module SCM
0
     
0
     def status(file_or_dir = nil, options = {})
0
       file_or_dir = file_or_dir.flatten.first if file_or_dir.is_a?(Array)
0
- file_or_dir = file_or_dir.dup if file_or_dir
0
       
0
       results = parse_status(command("status"))
0
       
0
       if file_or_dir
0
- file_or_dir << "/" if File.directory?(file_or_dir) unless /\/$/.match(file_or_dir)
0
+ file_or_dir = path_for(file_or_dir).dup
0
+ file_or_dir << "/" if File.directory?(file_or_dir) && file_or_dir[-1..-1] != "/"
0
         results.select do |status|
0
           if is_a_path?(status[:path]) && /^#{Regexp.escape(status[:path])}/i.match(file_or_dir)
0
             # promote this status on down and keep it if it's the parent folder of our target file_or_dir
...
69
70
71
 
 
 
 
 
 
 
 
 
72
73
74
...
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
0
@@ -69,6 +69,15 @@ EOF
0
     @result[:display].should == "dir/subfolder/"
0
   end
0
   
0
+ it "should auto-expand the path when filtering to a relative path" do
0
+ File.should_receive(:directory?).with("/base/dir/subfolder").and_return(true)
0
+ @results = @git.status("dir/subfolder")
0
+ @results.should have(1).result
0
+ @result = @results.first
0
+ @result[:path].should == "/base/dir/subfolder/"
0
+ @result[:display].should == "dir/subfolder/"
0
+ end
0
+
0
   it "should parse a status document correctly" do
0
     result = @git.parse_status_hash(fixture_file("status_output.txt"))
0
     result.should == {"dir/"=>"?",

Comments

    No one has commented yet.