Method: Git::Lib#rev_parse

Defined in:
lib/git/lib.rb

#rev_parse(revision) ⇒ String Also known as: revparse

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Verify and resolve a Git revision to its full SHA

Examples:

lib.rev_parse('HEAD') # => '9b9b31e704c0b85ffdd8d2af2ded85170a5af87d'
lib.rev_parse('9b9b31e') # => '9b9b31e704c0b85ffdd8d2af2ded85170a5af87d'

Parameters:

  • revision (String)

    the revision to resolve

Returns:

  • (String)

    the full commit hash

Raises:

  • (Git::FailedError)

    if the revision cannot be resolved

  • (ArgumentError)

    if the revision is a string starting with a hyphen

See Also:



385
386
387
388
389
# File 'lib/git/lib.rb', line 385

def rev_parse(revision)
  assert_args_are_not_options('rev', revision)

  command('rev-parse', '--revs-only', '--end-of-options', revision, '--')
end