Method: Git::Base#with_temp_index
- Defined in:
- lib/git/base.rb
permalink #with_temp_index(&blk)
600 601 602 603 604 605 606 607 608 609 610 611 612 613 |
# File 'lib/git/base.rb', line 600 def with_temp_index &blk # Workaround for JRUBY, since they handle the TempFile path different. # MUST be improved to be safer and OS independent. if RUBY_PLATFORM == 'java' temp_path = "/tmp/temp-index-#{(0...15).map{ ('a'..'z').to_a[rand(26)] }.join}" else tempfile = Tempfile.new('temp-index') temp_path = tempfile.path tempfile.close tempfile.unlink end with_index(temp_path, &blk) end |