Class: Git::Commands::DiffFiles Private
- Defined in:
- lib/git/commands/diff_files.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.
arguments block audited against
https://git-scm.com/docs/git-diff-files/2.53.0
Implements the git diff-files command
Compares the index (staging area) to the working tree, showing files that have been modified but not yet staged. This is the plumbing equivalent of checking for unstaged changes.
Examples:
Typical usage
Typical usage
diff_files = Git::Commands::DiffFiles.new(execution_context)
diff_files.call
diff_files.call(patch: true)
diff_files.call('lib/', 'spec/')
diff_files.call(q: true)
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(*path, **options) ⇒ Git::CommandLineResult
Overloads:
-
#call(**options) ⇒ Git::CommandLineResult
Compare the index to the working tree with no path restriction
Parameters:
-
options
(Hash)
—
command options
Options Hash (**options):
-
:q
(Boolean, nil)
— default:
nil
—
do not complain about nonexistent files; only report exit status
-
:unmerged
(Boolean, nil)
— default:
nil
—
for unmerged entries, suppress diff output and show only "Unmerged"
-
:base
(Boolean, nil)
— default:
nil
—
for unmerged entries, diff against stage 1 (common ancestor)
Short form:
-1 -
:ours
(Boolean, nil)
— default:
nil
—
for unmerged entries, diff against stage 2 (our changes)
Short form:
-2 -
:theirs
(Boolean, nil)
— default:
nil
—
for unmerged entries, diff against stage 3 (their changes)
Short form:
-3 -
:c
(Boolean, nil)
— default:
nil
—
for unmerged entries, show a combined diff of stage 2, stage 3, and the working tree
-
:cc
(Boolean, nil)
— default:
nil
—
synonym for
c: true -
:patch
(Boolean, nil)
— default:
nil
—
generate unified diff patch output
Alias: :p, :u
-
:no_patch
(Boolean, nil)
— default:
nil
—
suppress all diff output
Alias: :s
-
:raw
(Boolean, nil)
— default:
nil
—
generate diff in raw format (default output)
-
:patch_with_raw
(Boolean, nil)
— default:
nil
—
synonym for
patch: true, raw: true -
:unified
(Integer, String)
— default:
nil
—
number of context lines around diff hunks
Alias: :U
-
:output
(String)
— default:
nil
—
write diff output to a file instead of stdout
-
:output_indicator_new
(String)
— default:
nil
—
character for new lines in patch output
-
:output_indicator_old
(String)
— default:
nil
—
character for old lines in patch output
-
:output_indicator_context
(String)
— default:
nil
—
character for context lines in patch output
-
:indent_heuristic
(Boolean, nil)
— default:
nil
—
shift hunk boundaries for readability (
--indent-heuristic) -
:no_indent_heuristic
(Boolean, nil)
— default:
nil
—
do not shift hunk boundaries for readability (
--no-indent-heuristic) -
:minimal
(Boolean, nil)
— default:
nil
—
spend extra time to minimize diff size
-
:patience
(Boolean, nil)
— default:
nil
—
use patience diff algorithm
-
:histogram
(Boolean, nil)
— default:
nil
—
use histogram diff algorithm
-
:anchored
(String, Array<String>)
— default:
nil
—
anchor lines matching the given text (repeatable)
-
:diff_algorithm
(String)
— default:
nil
—
diff algorithm to use
Accepted values:
'default','myers','minimal','patience','histogram'. -
:stat
(Boolean, String, nil)
— default:
nil
—
show a diffstat
Pass
truefor the default format, or a string like'80,40,5'for custom limits. -
:stat_width
(Integer, String)
— default:
nil
—
override diffstat total width
-
:stat_name_width
(Integer, String)
— default:
nil
—
override diffstat filename column width
-
:stat_graph_width
(Integer, String)
— default:
nil
—
override diffstat graph column width
-
:stat_count
(Integer, String)
— default:
nil
—
limit diffstat to this many lines
-
:compact_summary
(Boolean, nil)
— default:
nil
—
include creation/deletion mode changes in stat
-
:numstat
(Boolean, nil)
— default:
nil
—
show per-file insertion/deletion counts (machine-friendly)
-
:shortstat
(Boolean, nil)
— default:
nil
—
show aggregate totals line only
-
:dirstat
(Boolean, String, nil)
— default:
nil
—
show distribution of changes per directory
Pass
truefor the default, or a string like'lines,cumulative,10'for params.Alias: :X
-
:cumulative
(Boolean, nil)
— default:
nil
—
synonym for
dirstat: 'cumulative' -
:dirstat_by_file
(Boolean, String, nil)
— default:
nil
—
synonym for
dirstat: 'files,...' -
:summary
(Boolean, nil)
— default:
nil
—
show condensed extended header information
-
:patch_with_stat
(Boolean, nil)
— default:
nil
—
synonym for
patch: true, stat: true -
:z
(Boolean, nil)
— default:
nil
—
use NUL as output field terminator instead of newline
-
:name_only
(Boolean, nil)
— default:
nil
—
show only changed file names
-
:name_status
(Boolean, nil)
— default:
nil
—
show changed file names with status letters
-
:submodule
(Boolean, String, nil)
— default:
nil
—
how to show submodule differences
Pass
truefor the default, or a string like'log'or'diff'for a format name. -
:color
(Boolean, String, nil)
— default:
nil
—
control diff colorization (
--color)Pass
truefor--coloror a string like'always'or'auto'for a specific mode. -
:no_color
(Boolean, nil)
— default:
nil
—
suppress colorized output (
--no-color) -
:color_moved
(Boolean, String, nil)
— default:
nil
—
color moved lines differently (
--color-moved)Pass
truefor the default, or a mode string such as'zebra'or'dimmed-zebra'. -
:no_color_moved
(Boolean, nil)
— default:
nil
—
disable moved-line coloring (
--no-color-moved) -
:color_moved_ws
(String)
— default:
nil
—
whitespace handling for moved-line color detection
Comma-separated list of modes, e.g.
'ignore-space-at-eol,ignore-space-change'. -
:no_color_moved_ws
(Boolean, nil)
— default:
nil
—
synonym for
color_moved_ws: 'no' -
:word_diff
(Boolean, String, nil)
— default:
nil
—
show a word-level diff
Pass
truefor the defaultplainmode, or a string like'color','porcelain', or'none'for a specific mode. -
:word_diff_regex
(String)
— default:
nil
—
regular expression defining word boundaries for word diff
-
:color_words
(Boolean, String, nil)
— default:
nil
—
equivalent to
word_diff: 'color'plus an optional word regex -
:ignore_cr_at_eol
(Boolean, nil)
— default:
nil
—
ignore carriage-return at end of line
-
:ignore_space_at_eol
(Boolean, nil)
— default:
nil
—
ignore whitespace changes at end of line
-
:ignore_space_change
(Boolean, nil)
— default:
nil
—
ignore changes in amount of whitespace
Alias: :b
-
:ignore_all_space
(Boolean, nil)
— default:
nil
—
ignore all whitespace when comparing lines
Alias: :w
-
:ignore_blank_lines
(Boolean, nil)
— default:
nil
—
ignore changes whose lines are all blank
-
:ignore_matching_lines
(String, Array<String>)
— default:
nil
—
ignore changes whose lines all match the given regex (repeatable)
Alias: :I
-
:check
(Boolean, nil)
— default:
nil
—
warn if changes introduce whitespace errors or conflict markers
-
:ws_error_highlight
(String)
— default:
nil
—
highlight whitespace errors in the given diff line types (e.g.
'new','old,new','all') -
:no_renames
(Boolean, nil)
— default:
nil
—
disable rename detection
-
:rename_empty
(Boolean, nil)
— default:
nil
—
use empty blobs as rename sources (
--rename-empty) -
:no_rename_empty
(Boolean, nil)
— default:
nil
—
disallow empty blobs as rename sources (
--no-rename-empty) -
:full_index
(Boolean, nil)
— default:
nil
—
show full blob SHA in index line
-
:binary
(Boolean, nil)
— default:
nil
—
output binary diff suitable for
git apply -
:abbrev
(Boolean, String, nil)
— default:
nil
—
abbreviate blob names in raw output
Pass
truefor the default, or an integer string like'10'for a specific length. -
:break_rewrites
(Boolean, String, nil)
— default:
nil
—
break total rewrites into delete-and-create pairs
Alias: :B
-
:find_renames
(Boolean, String, nil)
— default:
nil
—
detect renames
Pass
truefor the default threshold, or a string like'90%'for a custom similarity threshold.Alias: :M
-
:find_copies
(Boolean, String, nil)
— default:
nil
—
detect copies as well as renames
Pass
truefor the default threshold, or a string like'75%'for a custom similarity threshold.Alias: :C
-
:find_copies_harder
(Boolean, nil)
— default:
nil
—
inspect all unmodified files as copy sources (very expensive for large repos)
-
:irreversible_delete
(Boolean, nil)
— default:
nil
—
omit preimage for deleted files
Alias: :D
-
:l
(Integer, String)
— default:
nil
—
limit the number of rename/copy candidates considered during exhaustive detection
-
:diff_filter
(String)
— default:
nil
—
select only certain kinds of changed files
A string of status letters such as
'A','M','D','ACDM', or lowercase to exclude. -
:S
(String)
— default:
nil
—
find changes that alter the occurrence count of the given string (pickaxe)
-
:G
(String)
— default:
nil
—
find changes whose patch text contains lines matching the given regex (pickaxe)
-
:find_object
(String)
— default:
nil
—
find changes involving the given object id
-
:pickaxe_all
(Boolean, nil)
— default:
nil
—
show all changes in a changeset when using
-Sor-G -
:pickaxe_regex
(Boolean, nil)
— default:
nil
—
treat the
-Sstring as an extended POSIX regular expression -
:O
(String)
— default:
nil
—
path to an orderfile controlling output file order
-
:skip_to
(String)
— default:
nil
—
discard files before the named file in the output
-
:rotate_to
(String)
— default:
nil
—
move files before the named file to end of output
-
:R
(Boolean, nil)
— default:
nil
—
swap the two diff inputs
-
:relative
(Boolean, String, nil)
— default:
nil
—
show paths relative to a directory (
--relative)Pass
trueto use the current directory, or a path string to name the directory explicitly. -
:no_relative
(Boolean, nil)
— default:
nil
—
use absolute paths in output (
--no-relative) -
:text
(Boolean, nil)
— default:
nil
—
treat all files as text
Alias: :a
-
:inter_hunk_context
(Integer, String)
— default:
nil
—
show context between diff hunks up to this many lines, fusing close hunks
-
:function_context
(Boolean, nil)
— default:
nil
—
show whole function as context for each change
Alias: :W
-
:exit_code
(Boolean, nil)
— default:
nil
—
exit with status 1 if differences are found, 0 if none
-
:quiet
(Boolean, nil)
— default:
nil
—
suppress all output
Implies
--exit-code. -
:ext_diff
(Boolean, nil)
— default:
nil
—
allow external diff helpers (
--ext-diff) -
:no_ext_diff
(Boolean, nil)
— default:
nil
—
disallow external diff helpers (
--no-ext-diff) -
:textconv
(Boolean, nil)
— default:
nil
—
allow external text-conversion filters (
--textconv) -
:no_textconv
(Boolean, nil)
— default:
nil
—
disallow external text-conversion filters (
--no-textconv) -
:ignore_submodules
(Boolean, String, nil)
— default:
nil
—
ignore submodule changes
Pass
truefor--ignore-submodules(equivalent to'all'), or a string such as'untracked','dirty','none', or'all'. -
:src_prefix
(String)
— default:
nil
—
source prefix for diff headers (e.g.
'a/') -
:dst_prefix
(String)
— default:
nil
—
destination prefix for diff headers (e.g.
'b/') -
:no_prefix
(Boolean, nil)
— default:
nil
—
omit source and destination prefixes
-
:default_prefix
(Boolean, nil)
— default:
nil
—
use the default
a/andb/prefixes -
:line_prefix
(String)
— default:
nil
—
prepend this prefix to every output line
-
:ita_invisible_in_index
(Boolean, nil)
— default:
nil
—
make
git add -Nentries appear as new files ingit diffand non-existent ingit diff --cached -
:max_depth
(Integer, String)
— default:
nil
—
maximum directory depth to descend for pathspecs
Returns:
-
(Git::CommandLineResult)
—
the result of calling
git diff-files
Raises:
-
(ArgumentError)
—
if unsupported options are provided
-
(Git::FailedError)
—
if git exits outside the allowed range (exit code > 1)
-
options
(Hash)
—
-
#call(*path, **options) ⇒ Git::CommandLineResult
Compare the index to the working tree, limiting output to specific paths
Parameters:
-
path
(Array<String>)
—
pathspecs limiting which files are compared
-
options
(Hash)
—
command options (same as the no-path overload)
Returns:
-
(Git::CommandLineResult)
—
the result of calling
git diff-files
Raises:
-
(ArgumentError)
—
if unsupported options are provided
-
(Git::FailedError)
—
if git exits outside the allowed range (exit code > 1)
-
path
(Array<String>)
—
|
|
# File 'lib/git/commands/diff_files.rb', line 156
|