@@ -52,7 +52,7 @@ def self.binary_version(binary_path)
5252 raise "Failed to get git version: #{ status } \n #{ result } " unless status . success?
5353
5454 version = result [ /\d +(\. \d +)+/ ]
55- version_parts = version . split ( '.' ) . collect { | i | i . to_i }
55+ version_parts = version . split ( '.' ) . collect ( & : to_i)
5656 version_parts . fill ( 0 , version_parts . length ...3 )
5757 end
5858
@@ -67,7 +67,7 @@ def self.init(directory = '.', options = {})
6767 }
6868
6969 directory = options [ :bare ] ? options [ :repository ] : options [ :working_directory ]
70- FileUtils . mkdir_p ( directory ) unless File . exist? ( directory )
70+ FileUtils . mkdir_p ( directory )
7171
7272 # TODO: this dance seems awkward: this creates a Git::Lib so we can call
7373 # init so we can create a new Git::Base which in turn (ultimately)
@@ -137,7 +137,7 @@ def self.open(working_dir, options = {})
137137 # of the opened working copy or bare repository
138138 #
139139 def initialize ( options = { } )
140- if working_dir = options [ :working_directory ]
140+ if ( working_dir = options [ :working_directory ] )
141141 options [ :repository ] ||= File . join ( working_dir , '.git' )
142142 options [ :index ] ||= File . join ( options [ :repository ] , 'index' )
143143 end
@@ -277,19 +277,19 @@ def set_working(work_dir, check = true)
277277
278278 # returns +true+ if the branch exists locally
279279 def is_local_branch? ( branch )
280- branch_names = branches . local . map { | b | b . name }
280+ branch_names = branches . local . map ( & : name)
281281 branch_names . include? ( branch )
282282 end
283283
284284 # returns +true+ if the branch exists remotely
285285 def is_remote_branch? ( branch )
286- branch_names = branches . remote . map { | b | b . name }
286+ branch_names = branches . remote . map ( & : name)
287287 branch_names . include? ( branch )
288288 end
289289
290290 # returns +true+ if the branch exists
291291 def is_branch? ( branch )
292- branch_names = branches . map { | b | b . name }
292+ branch_names = branches . map ( & : name)
293293 branch_names . include? ( branch )
294294 end
295295
@@ -874,7 +874,7 @@ def diff_path_status(objectish = 'HEAD', obj2 = nil)
874874 end
875875
876876 if File . file? ( repository )
877- repository = File . expand_path ( File . read ( repository ) [ 8 ..- 1 ] . strip , options [ :working_directory ] )
877+ repository = File . expand_path ( File . read ( repository ) [ 8 ..] . strip , options [ :working_directory ] )
878878 end
879879
880880 options [ :repository ] = repository
0 commit comments