class Git::Commands::RevParse

Implements the ‘git rev-parse` command

Picks out and massages parameters for other git commands. Most commonly used to resolve a revision specifier (branch name, tag, abbreviated SHA) to its full object name. Also provides repository metadata queries and argument classification for porcelain scripts.

The ‘–parseopt` and `–sq-quote` operation modes are excluded because they require stdin interaction or provide no value in a Ruby library.

@example Resolve HEAD to its full SHA

rev_parse = Git::Commands::RevParse.new(execution_context)
result = rev_parse.call('HEAD', verify: true)

@example Query the repository top-level directory

rev_parse = Git::Commands::RevParse.new(execution_context)
result = rev_parse.call(show_toplevel: true)

@example List all branch refs

rev_parse = Git::Commands::RevParse.new(execution_context)
result = rev_parse.call(branches: true)

@note ‘arguments` block audited against git-scm.com/docs/git-rev-parse/2.53.0

@see git-scm.com/docs/git-rev-parse git-rev-parse

@api private