Class: Git::Commands::LsFiles Private
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-ls-files/2.53.0
Implements the git ls-files command.
This command shows information about files in the index and the working tree. It is used to list tracked, untracked, ignored, and staged files.
Examples:
List staged files with stage info
List staged files with stage info
ls_files = Git::Commands::LsFiles.new(execution_context)
ls_files.call('.', stage: true)
List untracked files not ignored
List untracked files not ignored
ls_files = Git::Commands::LsFiles.new(execution_context)
ls_files.call(others: true, exclude_standard: true)
List ignored files
List ignored files
ls_files = Git::Commands::LsFiles.new(execution_context)
ls_files.call(others: true, ignored: true, exclude_standard: true)
List untracked files in a specific directory
List untracked files in a specific directory
ls_files = Git::Commands::LsFiles.new(execution_context)
ls_files.call(others: true, exclude_standard: true, chdir: '/path/to/workdir')
See Also:
Instance Method Summary collapse
-
#call(*file, **options) ⇒ Git::CommandLineResult
Execute the
git ls-filescommand.
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(*file, **options) ⇒ Git::CommandLineResult
Execute the git ls-files command.
Parameters:
-
file
(Array<String>)
—
paths to limit file listing
-
options
(Hash)
—
command options
Options Hash (**options):
-
:z
(Boolean, nil)
— default:
nil
—
use NUL line termination and do not quote filenames
-
:t
(Boolean, nil)
— default:
nil
—
show status tags together with filenames
-
:v
(Boolean, nil)
— default:
nil
—
similar to
-tbut use lowercase letters for files that are marked as assume unchanged -
:f
(Boolean, nil)
— default:
nil
—
similar to
-tbut use lowercase letters for files that are marked as fsmonitor valid -
:cached
(Boolean, nil)
— default:
nil
—
show all files cached in the index
Alias: :c
-
:deleted
(Boolean, nil)
— default:
nil
—
show files with an unstaged deletion
Alias: :d
-
:others
(Boolean, nil)
— default:
nil
—
show other (i.e. untracked) files in the output
Alias: :o
-
:ignored
(Boolean, nil)
— default:
nil
—
show only ignored files in the output
Must be used with either
:cachedor:others. When used with:cached, shows only cached files matching an exclude pattern. When used with:others, shows only untracked files matched by an exclude pattern.Alias: :i
-
:stage
(Boolean, nil)
— default:
nil
—
show object name, mode bits, and stage number
Alias: :s
-
:unmerged
(Boolean, nil)
— default:
nil
—
show information about unmerged files
Alias: :u
-
:killed
(Boolean, nil)
— default:
nil
—
show untracked files that need to be removed due to file/directory conflicts for tracked files
Alias: :k
-
:modified
(Boolean, nil)
— default:
nil
—
show files with an unstaged modification
Alias: :m
-
:resolve_undo
(Boolean, nil)
— default:
nil
—
show files having resolve-undo information
-
:directory
(Boolean, nil)
— default:
nil
—
show just the directory name (with trailing slash) when a whole directory is classified as "other"
-
:no_empty_directory
(Boolean, nil)
— default:
nil
—
do not list empty directories
-
:eol
(Boolean, nil)
— default:
nil
—
show EOL and encoding attributes of files
-
:deduplicate
(Boolean, nil)
— default:
nil
—
suppress duplicate filenames when showing only filenames
-
:exclude
(String)
— default:
nil
—
skip untracked files matching the given pattern
Alias: :x
-
:exclude_from
(String)
— default:
nil
—
read exclude patterns from the given file
Alias: :X
-
:exclude_per_directory
(String)
— default:
nil
—
read additional exclude patterns from the named file in each directory
-
:exclude_standard
(Boolean, nil)
— default:
nil
—
add the standard git exclusions
-
:error_unmatch
(Boolean, nil)
— default:
nil
—
treat unmatched files as an error
-
:with_tree
(String)
— default:
nil
—
pretend paths removed since the named tree-ish are still present when using
--error-unmatch -
:full_name
(Boolean, nil)
— default:
nil
—
force paths to be output relative to the project top-level directory
-
:recurse_submodules
(Boolean, nil)
— default:
nil
—
recursively calls ls-files on each active submodule in the repository
-
:abbrev
(Boolean, Integer, String, nil)
— default:
nil
—
show only a partial prefix of the object name; pass
truefor the default number of hex digits, or an Integer or String for a specific prefix length (e.g.,abbrev: 10orabbrev: "10") -
:debug
(Boolean, nil)
— default:
nil
—
after each filename, output raw index information (ctime data, mtime data, dev, ino, uid, gid, size, flags, flagsx)
-
:sparse
(Boolean, nil)
— default:
nil
—
if the index is sparse, show the sparse directory entries rather than expanding to the contained files
-
:format
(String)
— default:
nil
—
a string that interpolates %(fieldname) from the index entry for each file
-
:chdir
(String)
— default:
nil
—
run the command from the specified directory
Returns:
-
(Git::CommandLineResult)
—
the result of calling
git ls-files
Raises:
-
(ArgumentError)
—
if unsupported options are provided
-
(Git::FailedError)
—
if git exits with a non-zero exit status
|
|
# File 'lib/git/commands/ls_files.rb', line 76
|