Sha256: b696c881b798aa36b24964c2c728b18da5820530ca58ac8cb489372e972b8d08
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module RubyCritic module SourceControlSystem class Git < Base register_system def self.supported? `git branch 2>&1` && $?.success? end def self.to_s 'Git' end def revisions_count(path) `git log --follow --format=%h #{path.shellescape}`.count("\n") end def date_of_last_commit(path) `git log -1 --date=iso --format=%ad #{path.shellescape}`.chomp! end def revision? head_reference && $?.success? end def head_reference `git rev-parse --verify HEAD`.chomp! end def travel_to_head stash_successful = stash_changes yield ensure travel_to_original_state if stash_successful end private def stash_changes stashes_count_before = stashes_count `git stash` stashes_count_after = stashes_count stashes_count_after > stashes_count_before end def stashes_count `git stash list --format=%h`.count("\n") end def travel_to_original_state `git stash pop` end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubycritic-2.9.3 | lib/rubycritic/source_control_systems/git.rb |