Method: Chef::Provider::Git#find_current_revision

Defined in:
lib/chef/provider/git.rb

#find_current_revisionObject



148
149
150
151
152
153
154
155
# File 'lib/chef/provider/git.rb', line 148

def find_current_revision
  logger.trace("#{new_resource} finding current git revision")
  if ::TargetIO::File.exist?(::File.join(cwd, ".git"))
    # 128 is returned when we're not in a git repo. this is fine
    result = git("rev-parse", "HEAD", cwd: cwd, returns: [0, 128]).stdout.strip
  end
  sha_hash?(result) ? result : nil
end