Class: GitHealthCheck::GitLib

Inherits:
Object
  • Object
show all
Defined in:
lib/git-health-check/git_lib.rb

Instance Method Summary collapse

Instance Method Details

#count_objectsObject



12
13
14
# File 'lib/git-health-check/git_lib.rb', line 12

def count_objects
  `git count-objects -v`
end

#get_commit_author(commit_sha) ⇒ Object



4
5
6
# File 'lib/git-health-check/git_lib.rb', line 4

def get_commit_author(commit_sha)
  `git log #{commit_sha} -n 1 | grep Author | cut -f 2- -d ' '`.chomp
end

#get_commit_details(commit_sha) ⇒ Object



8
9
10
# File 'lib/git-health-check/git_lib.rb', line 8

def get_commit_details(commit_sha)
  `git show -s #{commit_sha} --format='%h: %cr'`.chomp
end

#get_largest_files(number = 10) ⇒ Object



16
17
18
# File 'lib/git-health-check/git_lib.rb', line 16

def get_largest_files(number=10)
  `git ls-files -z | xargs -0 ls -l | sort -nrk5 | head -n #{number}`
end

#get_object_sha_from_path(path) ⇒ Object



20
21
22
# File 'lib/git-health-check/git_lib.rb', line 20

def get_object_sha_from_path(path)
  `git ls-files -s #{path} | cut -d ' ' -f 2`
end

#get_revision_list(head = 'HEAD') ⇒ Object



24
25
26
# File 'lib/git-health-check/git_lib.rb', line 24

def get_revision_list(head='HEAD')
  `git rev-list #{head}`
end

#get_treeish_contents(treeish) ⇒ Object



28
29
30
# File 'lib/git-health-check/git_lib.rb', line 28

def get_treeish_contents(treeish)
  `git ls-tree -zrl #{treeish}`
end