lib/gh_compare.rb in gh_compare-0.1.3 vs lib/gh_compare.rb in gh_compare-0.1.4

- old
+ new

@@ -16,10 +16,14 @@ def compare_url(from, to) remote_url + "/compare/#{from}...#{to}" end + def compare_before(num) + compare_url(head_before(num), head) + end + private def get_remote_origin `git config --get remote.origin.url`.strip end @@ -28,8 +32,16 @@ URI.parse(remote_origin).is_a?(URI::HTTP) rescue false end def ssh_to_url "https://github.com/#{remote_origin.gsub(/git@github.com:/, '').gsub(/\.git$/, '')}" + end + + def head + `git rev-parse HEAD`.strip + end + + def head_before(num) + `git rev-parse HEAD~#{num}`.strip end end end