vendor/chef/chef-deploy/lib/chef-deploy/git.rb
# Getting the actual commit id, in case we were passed a tag
# or partial sha or something - it will return the sha if you pass a sha, too
Getting the actual commit id, in case we were passed a tag
or partial sha or something - it will return the sha if you pass a sha, too
Getting the actual commit id in case we were passed a tag or partial sha or something - it will return the sha if you pass a sha too
def query_revision(revision)
    raise ArgumentError, "Deploying remote branches is no longer supported.  Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}')." if revision =~ /^origin\//
    return revision if revision =~ /^[0-9a-f]{40}$/
    command = scm('ls-remote', configuration[:repository], revision)
    result = yield(command)
    rev, ref = result.split(/[\t\n]/)
    newrev = nil
    if ref.sub(/refs\/.*?\//, '').strip == revision
      newrev = rev
    end
    raise "Unable to resolve revision for '#{revision}' on repository '#{configuration[:repository]}'." unless newrev =~ /^[0-9a-f]{40}$/
    return newrev
  end
def query_revision ( revision ) raise ArgumentError , "Deploying remote branches is no longer supported.  Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}')." if revision =~ / ^origin \/ / return revision if revision =~ / ^[0-9a-f]{40}$ / command = scm ( 'ls-remote' , configuration [ :repository ] , revision ) result = yield ( command ) rev , ref = result . split ( / [ \t \n ] / ) newrev = nil if ref . sub ( / refs \/ .*? \/ / , '' ) . strip == revision newrev = rev end raise "Unable to resolve revision for '#{revision}' on repository '#{configuration[:repository]}'." unless newrev =~ / ^[0-9a-f]{40}$ / return newrev end
Getting the actual commit id, in case we were passed a tag
or partial sha or something - it will return the sha if you pass a sha, too
Getting the actual commit id in case we were passed a tag or partial sha or something - it will return the sha if you pass a sha too
revision