Sha256: b10795aa69500b4200eeae19c2cd27cb59822eb08f91caef61926be6f2975017
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
require "git-hack/version" require "git" Dir["#{File.dirname(__FILE__)}/**/*.rb"].each { |f| require f } module GitHack def self.current @current || get_dir('.') end def self.commit current.commit end private # get_dir(path) 检查给定目录是否在git受控目录中 # 本身是git目录返回 GitProject # 本身不是,但上层是返回GitProject,并设置dir # 本身不是,上层也不是则返回RawDir def self.get_dir(path) return GitRepo.new(path) if is_git(path) return get_dir(File.join(path,"/../")) end def self.is_git(path) File.directory?(File.join(path,"/.git")) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git-hack-0.0.3 | lib/git-hack.rb |