class String
Test if a (String
) path is a repo
Public Instance Methods
repo?()
click to toggle source
# File lib/git-blog/workflow.rb 8 def repo? 9 ret = false 10 11 # Use git rev-parse command to test if a directory is a repo 12 full_path = File.expand_path self 13 if File.directory? full_path 14 Dir.chdir full_path do 15 system "git rev-parse --show-toplevel > /dev/null 2>&1" 16 ret = $?.exitstatus == 0 17 end 18 end 19 20 ret 21 end