Class: Git::Commands::Status Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/status.rb

Overview

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

Note:

arguments block audited against https://git-scm.com/docs/git-status/2.53.0

Implements the git status command

Shows the working tree status — the differences between the index and the current HEAD commit, and between the working directory and the index.

Examples:

Show working tree status

status = Git::Commands::Status.new(execution_context)
status.call

Show short-format status

status = Git::Commands::Status.new(execution_context)
status.call(short: true)

Show status in porcelain v2 format

status = Git::Commands::Status.new(execution_context)
status.call(porcelain: 'v2')

Show status for specific paths

status = Git::Commands::Status.new(execution_context)
status.call('lib/', 'spec/')

Show all untracked files

status = Git::Commands::Status.new(execution_context)
status.call(untracked_files: 'all')

See Also:

Instance Method Summary collapse

Methods inherited from Base

allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation

Constructor Details

This class inherits a constructor from Git::Commands::Base

Instance Method Details

#call(*pathspecs, **options) ⇒ Git::CommandLineResult

Execute the git status command

Parameters:

  • pathspecs (Array<String>)

    limit output to the named paths

  • options (Hash)

    command options

Options Hash (**options):

  • :short (Boolean, nil) — default: nil

    give output in short format

    Alias: :s

  • :branch (Boolean, nil) — default: nil

    show the branch and tracking info even in short-format

    Alias: :b

  • :show_stash (Boolean, nil) — default: nil

    show the number of entries currently stashed away

  • :porcelain (Boolean, String, nil) — default: nil

    give the output in an easy-to-parse format for scripts

    When true, gives porcelain format. When a string (e.g. 'v1', 'v2'), gives the specified porcelain format version.

  • :long (Boolean, nil) — default: nil

    give output in long format (the default)

  • :verbose (Boolean, nil) — default: nil

    in addition to names of files that have been changed, also show the textual changes that are staged

    Alias: :v

  • :untracked_files (Boolean, String, nil) — default: nil

    show untracked files

    Mode can be 'no', 'normal', or 'all'. When true, uses the default mode.

    Alias: :u

  • :ignore_submodules (Boolean, String, nil) — default: nil

    ignore changes to submodules

    Mode can be 'none', 'untracked', 'dirty', or 'all'.

  • :ignored (Boolean, String, nil) — default: nil

    show ignored files as well

    Mode can be 'traditional', 'no', or 'matching'.

  • :z (Boolean, nil) — default: nil

    terminate entries with NUL instead of newline (-z)

    Implies --porcelain=v1

  • :column (Boolean, String, nil) — default: nil

    display untracked files in columns (--column)

    Pass true for --column or a string of options for --column=<options>.

  • :no_column (Boolean, nil) — default: nil

    disable column output (--no-column)

  • :ahead_behind (Boolean, nil) — default: nil

    show ahead/behind counts for the branch (--ahead-behind)

  • :no_ahead_behind (Boolean, nil) — default: nil

    suppress ahead/behind counts for the branch (--no-ahead-behind)

  • :renames (Boolean, nil) — default: nil

    turn on rename detection (--renames)

  • :no_renames (Boolean, nil) — default: nil

    turn off rename detection (--no-renames)

  • :find_renames (Boolean, String, nil) — default: nil

    turn on rename detection with optional similarity threshold

    When true, enables rename detection without a threshold. When a string (e.g. '50'), adds --find-renames=<n>.

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/status.rb', line 80