Commits

Ryan Wilcox committed 02c6f03 Merge

merge

Comments (0)

Files changed (2)

   puts "\nWARNING: local and remote branches have diverged. A merge will occur unless you rebase." if both
 end
 
-branches = `git show-ref`.inject({}) do |hash, l|
+#Required for Ruby 1.9+ as string arrays are handled differently
+unless String.method_defined?(:lines) then
+  class String
+    def lines
+      to_a
+    end
+  end
+end
+
+branches = `git show-ref`.lines.to_a.inject({}) do |hash, l|
   sha1, ref = l.chomp.split " refs/"
   next hash if $config["ignore"].member? ref
   next hash unless ref =~ /^heads\/(.+)/
   hash
 end
 
-remotes = `git config --get-regexp ^remote\.\*\.url`.inject({}) do |hash, l|
+remotes = `git config --get-regexp ^remote\.\*\.url`.lines.to_a.inject({}) do |hash, l|
   l =~ /^remote\.(.+?)\.url (.+)$/ or next hash
   hash[$1] ||= $2
   hash
 end
 
-`git config --get-regexp ^branch\.`.each do |l|
+`git config --get-regexp ^branch\.`.lines.to_a.each do |l|
   case l
   when /branch\.(.*?)\.remote (.+)/
     next if $2 == '.'
 bind editor <ESC>0 bol
 bind editor <ESC>$ eol
 bind editor <ESC>Dw kill-word
+bind editor <ESC>dd kill-line
 
 macro index     h "c?t"