class R10KHelper::R10K::Git::ShellGit::ThinRepository
Horrible, but we need to be able to manipulate the cache
Public Instance Methods
cache_repo()
click to toggle source
# File lib/simp/rake/build/deps.rb, line 14 def cache_repo @cache_repo end
dirty?(exclude_spec=false)
click to toggle source
Return true if the repository has local modifications, false otherwise.
# File lib/simp/rake/build/deps.rb, line 19 def dirty?(exclude_spec=false) repo_status = false return repo_status unless File.directory?(path) Dir.chdir(path) do %x(git update-index -q --ignore-submodules --refresh) repo_status = "Could not update git index for '#{path}'" unless $?.success? unless repo_status %x(git diff-files --quiet --ignore-submodules --) repo_status = "'#{path}' has unstaged changes" unless $?.success? end unless repo_status %x(git diff-index --cached --quiet HEAD --ignore-submodules --) repo_status = "'#{path}' has uncommitted changes" unless $?.success? end unless repo_status # Things that may be out of date but which should stop the updating # of the git repo our_exclusions=[ 'build/rpm_metadata', 'dist/' ] untracked_files = %x(git ls-files -o -d --exclude-standard --exclude=#{our_exclusions.join(' --exclude=')}) if $?.success? unless untracked_files.empty? untracked_files.strip! if untracked_files.lines.count > 0 repo_status = "'#{path}' has untracked files" end end else # We should never get here raise Error, "Failure running 'git ls-files -o -d --exclude-standard' at '#{path}'" end end end repo_status end