Class: Git::Commands::Stash::Show Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/stash/show.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-stash/2.53.0

Show the changes recorded in a stash entry as a diff

Shows the changes recorded in the stash entry as a diff between the stashed contents and the commit back when the stash entry was first created.

Examples:

Show numstat for the latest stash

Git::Commands::Stash::Show.new(ctx).call(numstat: true, shortstat: true)

Show patch for a specific stash

Git::Commands::Stash::Show.new(ctx).call('stash@{2}', patch: true, numstat: true, shortstat: true)

Show with directory statistics

Git::Commands::Stash::Show.new(ctx).call(numstat: true, shortstat: true, dirstat: true)
Git::Commands::Stash::Show.new(ctx).call(numstat: true, shortstat: true, dirstat: 'lines,cumulative')

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(**options) ⇒ Git::CommandLineResult #call(stash, **options) ⇒ Git::CommandLineResult

Show stash diff

Overloads:

  • #call(**options) ⇒ Git::CommandLineResult

    Show diff for the latest stash

    Parameters:

    • options (Hash)

      command options

    Options Hash (**options):

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

      include unified diff patches per file

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

      include per-file insertion/deletion counts

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

      include per-file mode/SHA/status metadata

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

      include aggregate totals line

    • :unified (Integer, String) — default: nil

      generate diff with lines of context

      Alias: :U

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

      include untracked files (--include-untracked)

      Alias: :u

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

      exclude untracked files (--no-include-untracked)

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

      show only untracked files

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

      detect renames; optionally pass a similarity threshold (e.g., 50 for 50%). Alias: :M

    • :find_copies (Boolean, Integer, nil) — default: nil

      detect copies as well as renames; optionally pass a threshold. Alias: :C

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

      inspect all files as copy sources; expensive

    • :inter_hunk_context (Integer, String) — default: nil

      show context between diff hunks, up to lines, fusing hunks that are close to each other

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

      include directory statistics

      Pass true for default, or a string like 'lines,cumulative' for options.

  • #call(stash, **options) ⇒ Git::CommandLineResult

    Show diff for a specific stash

    Parameters:

    • stash (String)

      stash reference (e.g., 'stash@{0}', '0')

    • options (Hash)

      command options

    Options Hash (**options):

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

      include unified diff patches per file

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

      include per-file insertion/deletion counts

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

      include per-file mode/SHA/status metadata

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

      include aggregate totals line

    • :unified (Integer, String) — default: nil

      generate diff with lines of context

      Alias: :U

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

      include untracked files (--include-untracked)

      Alias: :u

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

      exclude untracked files (--no-include-untracked)

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

      show only untracked files

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

      detect renames; optionally pass a similarity threshold (e.g., 50 for 50%). Alias: :M

    • :find_copies (Boolean, Integer, nil) — default: nil

      detect copies as well as renames; optionally pass a threshold. Alias: :C

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

      inspect all files as copy sources; expensive

    • :inter_hunk_context (Integer, String) — default: nil

      show context between diff hunks, up to lines, fusing hunks that are close to each other

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

      include directory statistics

      Pass true for default, or a string like 'lines,cumulative' for options.

Returns:

Raises:



# File 'lib/git/commands/stash/show.rb', line 53