public
Fork of mojombo/grit
Description: Grit is a Ruby library for extracting information from a git repository in an object oriented manner.
Homepage: http://grit.rubyforge.org/
Clone URL: git://github.com/technoweenie/grit.git
better alternates behavior
mojombo (author)
Thu Feb 14 20:18:26 -0800 2008
technoweenie (committer)
Sun Feb 17 23:19:11 -0800 2008
commit  125c3f885f9041a48b2828cd1c707dbaff78a825
tree    58ecbd29348e6194379989ff43fecc220bb32d41
parent  3ea514188523ae9e8ecd603f760442f147042d6c
...
269
270
271
272
273
 
 
 
 
 
 
274
275
276
...
269
270
271
 
 
272
273
274
275
276
277
278
279
280
0
@@ -269,8 +269,12 @@ module Grit
0
         end
0
       end
0
       
0
- File.open(File.join(self.path, *%w{objects info alternates}), 'w') do |f|
0
- f.write alts.join("\n")
0
+ if alts.empty?
0
+ File.delete(File.join(self.path, *%w{objects info alternates}))
0
+ else
0
+ File.open(File.join(self.path, *%w{objects info alternates}), 'w') do |f|
0
+ f.write alts.join("\n")
0
+ end
0
       end
0
     end
0
     
...
241
242
243
 
 
 
 
 
 
244
245
246
...
241
242
243
244
245
246
247
248
249
250
251
252
0
@@ -241,6 +241,12 @@ class TestRepo < Test::Unit::TestCase
0
     end
0
   end
0
   
0
+ def test_alternates_setter_empty
0
+ File.expects(:delete)
0
+
0
+ @r.alternates = []
0
+ end
0
+
0
   # inspect
0
   
0
   def test_inspect

Comments

    No one has commented yet.