Module: Git::Commands::ShowRef Private

Defined in:
lib/git/commands/show_ref.rb,
lib/git/commands/show_ref/list.rb,
lib/git/commands/show_ref/exists.rb,
lib/git/commands/show_ref/verify.rb,
lib/git/commands/show_ref/exclude_existing.rb

Overview

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

Commands for querying git refs via git show-ref

This module contains command classes split by invocation mode:

  • List — standard ref listing with optional pattern filtering (git show-ref [options] [<pattern>...])
  • Verify — strict per-ref verification by full refname (git show-ref --verify [options] [<ref>...])
  • ExcludeExisting — stdin-based filter for ref names, excluding refs that already exist in the repository (git show-ref --exclude-existing[=<pattern>])
  • Exists — boolean existence check without output (git >= 2.43) (git show-ref --exists <ref>)

Examples:

List all refs matching a pattern

cmd = Git::Commands::ShowRef::List.new(execution_context)
result = cmd.call('refs/tags/', tags: true)
result.stdout
# => "abc1234 refs/tags/v1.0\ndef5678 refs/tags/v2.0\n"

Verify a specific ref

cmd = Git::Commands::ShowRef::Verify.new(execution_context)
result = cmd.call('refs/heads/main')
result.stdout  # => "abc1234 refs/heads/main\n"

See Also:

Defined Under Namespace

Classes: ExcludeExisting, Exists, List, Verify