<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,8 +5,8 @@ module TinyGit
       arguments.unshift(sha)
       command_lines(:ls_tree, *arguments).map do |line|
         (info, path) = line.split(&quot;\t&quot;)
-        (mode, type, sha) = info.split
-        {:sha =&gt; sha, :path =&gt; path, :type =&gt; type, :mode =&gt; mode}
+        (mode, type, sha) = info.split        
+        {:sha =&gt; sha, :path =&gt; unescape(path), :type =&gt; type, :mode =&gt; mode}
       end
     end
 
@@ -36,9 +36,9 @@ module TinyGit
     
     def command(cmd, *args)
       opt_args = transform_options(args.extract_options!)
-      ext_args = args.reject { |a| a.empty? }.map { |a| (a == '--' || a[0].chr == '|') ? a : &quot;'#{escape(a)}'&quot; }
+      ext_args = args.reject { |a| a.empty? }.map { |a| (a == '--' || a[0].chr == '|') ? a : escape(a) }
 
-      call = &quot;#{TinyGit.git_binary} --git-dir='#{self.git_dir}' #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}&quot;
+      call = &quot;#{TinyGit.git_binary} --git-dir=#{escape(self.git_dir)} #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}&quot;
       run_command(call)
     end
 
@@ -75,7 +75,14 @@ module TinyGit
       end
 
       def escape(s)
-        &quot;'&quot; + s.to_s.gsub('\'', '\'\\\'\'') + &quot;'&quot;
+        s.to_s.inspect
+      end
+
+      UNESCAPE_MAP = { '\\\\' =&gt; '\\', '\\&quot;'  =&gt; '&quot;' }
+      
+      def unescape(s)
+        return s unless s =~ /[&quot;]/ 
+        s.gsub(/^[&quot;]/, '').gsub(/[&quot;]$/, '').gsub(/(\\\\|\\[&quot;])/) { UNESCAPE_MAP[$1] }
       end
 
       def raise_execution_error(status, output, call)</diff>
      <filename>vendor/plugins/tiny-git/lib/tiny_git/commands.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ describe 'TinyGit - Caching' do
     TinyGit.result_cache.should == {}      
     TinyGit.cache do
       3.times { TEST_REP.rev_parse 'HEAD' }
-      TinyGit.result_cache.should == { &quot;/usr/bin/env git --git-dir='#{TEST_REP.git_dir}' rev-parse ''HEAD''&quot;=&gt;&quot;[RESULT]&quot; }
+      TinyGit.result_cache.should == { &quot;/usr/bin/env git --git-dir=\&quot;#{TEST_REP.git_dir}\&quot; rev-parse \&quot;HEAD\&quot;&quot;=&gt;&quot;[RESULT]&quot; }
     end
     TinyGit.result_cache.should == {}    
   end</diff>
      <filename>vendor/plugins/tiny-git/spec/caching_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,6 +19,13 @@ describe TinyGit::Object::Tree do
     tree.trees.should have(1).items
   end
 
+  it 'should correctly parse sub-nodes' do
+    tree('e01e2d50919b243e68d463bbeea14be7adf5a5b1').blobs.keys.sort.should == [
+      'another \ one.txt',
+      'this file\'s name is (a &quot;little&quot;) strange.txt'      
+    ]    
+  end
+
   it 'should have a full sha' do
     tree('b090a05').to_s.should == 'b090a05'
     tree('b090a05').sha.should == 'b090a05f9f70e6af595610118a817c2e51760c65'    </diff>
      <filename>vendor/plugins/tiny-git/spec/object/tree_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -53,9 +53,17 @@ describe TinyGit::Repo do
   end
 
   it 'should catch and re-raise GIT errors' do
-    msg = &quot;[128] fatal: Not a valid object name 9999999 (/usr/bin/env git --git-dir='./spec/test_rep/.git' cat-file -s ''9999999'')&quot; 
+    msg = &quot;[128] fatal: Not a valid object name 9999999 (/usr/bin/env git --git-dir=\&quot;./spec/test_rep/.git\&quot; cat-file -s \&quot;9999999\&quot;)&quot; 
     lambda { new_repo.cat_file('9999999', :s =&gt; true) }.should raise_error(TinyGit::GitExecuteError, msg)
   end  
+
+  it 'should handle unusual file name variations' do
+    tree = new_repo.ls_tree 'HEAD', '--', 'res/this file\'s name is (a &quot;little&quot;) strange.txt' 
+    tree.should == [{:type=&gt;&quot;blob&quot;, :mode=&gt;&quot;100644&quot;, :path=&gt;'res/this file\'s name is (a &quot;little&quot;) strange.txt', :sha=&gt;&quot;bb590f885cfa35e3a4bdb3396da8b14b4904d045&quot;}]
+
+    tree = new_repo.ls_tree 'HEAD', '--', 'res/another \ one.txt'
+    tree.should == [{:type=&gt;&quot;blob&quot;, :mode=&gt;&quot;100644&quot;, :path=&gt; 'res/another \ one.txt', :sha=&gt;&quot;bb590f885cfa35e3a4bdb3396da8b14b4904d045&quot;}]
+  end
   
 end
 </diff>
      <filename>vendor/plugins/tiny-git/spec/repo_spec.rb</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>vendor/plugins/tiny-git/spec/test_rep.tgz</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e58c0b93d790b4ed1a9e906d60b36e6e8ce320e7</id>
    </parent>
  </parents>
  <author>
    <name>Dimitrij Denissenko</name>
    <email>contact@dvisionfactory.com</email>
  </author>
  <url>http://github.com/dim/retrospectiva/commit/a4e0130b8bee0c8654ce5c61eb82885de6d631da</url>
  <id>a4e0130b8bee0c8654ce5c61eb82885de6d631da</id>
  <committed-date>2009-10-30T01:41:15-07:00</committed-date>
  <authored-date>2009-10-30T01:41:15-07:00</authored-date>
  <message>Fixed Tiny-GIT path escaping [#703]</message>
  <tree>22e94462f7e1d2f5b3834a0baf6da40d3b2da3fe</tree>
  <committer>
    <name>Dimitrij Denissenko</name>
    <email>contact@dvisionfactory.com</email>
  </committer>
</commit>
