libra ls-files
Command reference for `libra ls-files`
List tracked index entries and untracked working-tree paths.
Synopsis
libra ls-files [OPTIONS] [pathspec]...
Description
libra ls-files reads Libra's index and working tree and prints repository
paths without mutating refs, the index, the worktree, or object storage.
With no state filter it defaults to the cached index view, so tracked paths
remain listed even when the working tree copy is modified or deleted.
This public compatibility slice supports cached listing, modified/deleted
filters, stage-style output, untracked listing, Git/Libra ignore-source
filtering via --others --exclude-standard, ignored-only listing via -i/--ignored
(-i -o for ignored untracked files, -i -c for tracked files matching an
exclude pattern), repository-local pathspec filtering, --error-unmatch,
NUL-delimited text output via -z, status tags via -t, and unmerged-only
listing via -u / --unmerged. Without an explicit pathspec the listing is scoped to the current directory and
paths are printed relative to it; --full-name switches the representation to
repo-root-relative paths without widening that scope. An explicitly selected
entry outside the cwd is printed as ../….
Tracked symlinks are inspected as symlinks for --deleted and --modified:
a dangling symlink still exists and is not listed as deleted, while a changed
link target is listed as modified.
Pathspecs are resolved from the caller's current working directory, not forced
to the repository root. Exact-file and directory-prefix filtering are both
supported, and the shared pathspec engine also accepts :(top), :(exclude),
:(icase), :(literal), and :(glob) magic. Pathspecs that resolve outside
the repository are rejected. The resolve-undo and sparse-checkout integration
remain deferred.
Skip-worktree entries (see update-index) are visible in
plain, -t, and -v listings — tagged S — but are excluded from -d and
-m (Git never consults the working tree for them).
Intent-to-add entries (libra add -N) are ordinary stage-0 index entries for
listing purposes: ls-files -s prints mode 100644, the canonical empty blob
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391, and stage 0, matching Git.
When stdout is piped and the downstream command exits early, libra ls-files exits quietly
without printing panic/backtrace or Broken pipe diagnostics.
Options
| Option | Description |
|---|---|
--cached |
Show cached index entries. This is the default when no state filter is provided. |
--deleted, -d |
Show tracked paths whose working-tree file is missing. |
--modified, -m |
Show tracked paths whose working-tree content hash differs from the index. |
--stage |
Print stage-style records, including conflict stages when present. |
-s |
Short alias for stage-style output: <mode> <object> <stage>\t<path>. |
--abbrev[=<n>] |
Abbreviate the object name to <n> hex digits in -s/--stage output. Bare --abbrev uses 7; --abbrev=<n> sets the length (the value requires the = form, so bare --abbrev never consumes a following pathspec). Libra truncates to a fixed length rather than computing the shortest unique prefix. |
-t |
Prefix each path with a status tag: H (cached), R (removed/deleted), C (modified/changed), ? (other/untracked), M (unmerged), S (skip-worktree). Unmerged paths are not hidden; each stage 1/2/3 entry is printed as M <path>, matching Git's conflict visibility. A skip-worktree entry always tags S and is never reported deleted/modified. |
-v |
Like -t: prefix each path with a status tag. Git's -v spells assume-unchanged files in lowercase, which Libra does not support, so -v output equals -t output. Plain ls-files, -c, -z and --json walk every index stage, so an unmerged path prints one row per conflict stage (stage 1/2/3) exactly like Git's show_files; -v tags those rows M. |
-u, --unmerged |
Show only unmerged (conflict) entries — index stages 1/2/3 — in stage-style output. |
--full-name |
Print repo-root-relative paths instead of cwd-relative ones (the implicit cwd scope is unchanged). |
--others, -o |
Show untracked working-tree files. A path present in the index at any stage — including an unmerged conflict stage — is tracked, never "other" (Git's index_name_is_other), so conflict paths (f, g.log above) are excluded even while the merge is unresolved. |
--cached, -c |
Show files staged in the index. |
-i, --ignored |
Show only the ignored set: -i -o lists ignored untracked files (the inverse of -o), -i -c lists tracked files matching an exclude pattern. Must be combined with -o/-c and needs an exclude source — --exclude-standard or an explicit -x/-X pattern (exit 128 otherwise), matching Git. |
--exclude-standard |
With --others, honor standard Git/Libra ignore sources (.gitignore, the worktree-local info/exclude — .libra/info/exclude, plus .git/info/exclude in Git- or dual-layout trees — core.excludesFile, and .libraignore). |
-x, --exclude <pattern> |
Skip untracked files matching <pattern> (gitignore syntax) from the --others listing. Repeatable; supplements --exclude-standard. With -i the pattern instead defines the ignored set. |
-X, --exclude-from <file> |
Read additional exclude patterns from <file> (one per line; # comments and blank lines skipped) and apply them like -x. Repeatable. |
--error-unmatch |
Exit 1 with LBR-CLI-003 if any explicit pathspec matches no files in the selected result set. |
--debug |
Append Git's cached-stat block after each cached record: ctime: <s>:<ns>, mtime: <s>:<ns>, dev/ino, uid/gid, size/flags. Untracked (-o) rows have no cached stat and print the path only. Composes with -s/-t/--eol. |
--eol |
Prefix each cached entry with i/<eol> w/<eol> attr/<attr> line-ending info: <eol> is lf/crlf/mixed/none/-text (binary) for the index blob (i/) and the worktree file (w/). Byte-compatible with git ls-files --eol; attr/ is currently empty because line-ending attribute reporting is not implemented. |
-z |
Emit NUL-delimited text records instead of newline-delimited output. Text mode only; rejects --json / --machine. |
<pathspec>... |
Limit output to matching paths. Supports exact files, directory prefixes, default wildcards, and :(top) / :(exclude) / :(icase) / :(literal) / :(glob) magic. Pathspecs resolve from the current working directory unless :(top) is used. |
--json |
Emit the standard Libra JSON envelope. |
--machine |
Emit the same envelope as one compact JSON line. |
Examples
libra ls-files
libra ls-files --modified
libra ls-files --deleted
libra ls-files --others
libra ls-files --others --exclude-standard
libra ls-files -o -x '*.log' # untracked files except *.log
libra ls-files -o -X .extra-excludes # read extra exclude patterns from a file
libra ls-files -i -o --exclude-standard # only the ignored untracked files
libra ls-files tracked-dir
libra ls-files --others --exclude-standard others-dir
libra ls-files --error-unmatch src/lib.rs
libra ls-files -z tracked-dir
libra ls-files --stage
libra ls-files -t
libra ls-files -t --others --exclude-standard
libra ls-files -u
libra --json ls-files --modified
Human Output
Default output prints one repository path per line:
.libraignore
tracked.txt
--stage and -s print Git-style stage records:
100644 4f3c2d1a7b8c9d0e1234567890abcdef12345678 0 tracked.txt
Unmerged entries are visible both as stage rows and as tagged rows:
100644 1111111111111111111111111111111111111111 1 conflict.txt
100644 2222222222222222222222222222222222222222 2 conflict.txt
100644 3333333333333333333333333333333333333333 3 conflict.txt
M conflict.txt
M conflict.txt
M conflict.txt
-z keeps the same record shape but terminates each record with NUL instead of
newline, which is useful for shell-safe scripting:
tracked-dir/alpha.txt\0tracked-dir/bravo.txt\0
Structured Output
--json and --machine use the standard Libra command envelope. Each entry in
data includes path, hash, mode, stage, and status. Untracked
entries use null for fields that do not apply:
{
"ok": true,
"command": "ls-files",
"data": [
{
"path": "tracked.txt",
"hash": "4f3c2d1a7b8c9d0e1234567890abcdef12345678",
"mode": "100644",
"stage": 0,
"status": "modified"
},
{
"path": "untracked.txt",
"hash": null,
"mode": null,
"stage": null,
"status": "other"
}
]
}
Parameter Comparison: Libra vs Git vs Jujutsu
| Feature | Libra | Git | Jujutsu |
|---|---|---|---|
| Cached index listing | Default / --cached |
Default / --cached |
Use status/file commands |
| Modified tracked files | -m / --modified |
-m / --modified |
Use status/diff commands |
| Deleted tracked files | -d / --deleted |
-d / --deleted |
Use status commands |
| Stage-style output | --stage / -s |
--stage / -s |
Different model |
| Abbreviate object name | --abbrev[=<n>] (fixed-length) |
--abbrev[=<n>] (shortest unique) |
N/A |
| Untracked files | --others |
--others |
Use status/file commands |
| Ignore-aware untracked | --others --exclude-standard |
Same | Different model |
| Ignored files only | -i -o --exclude-standard |
Same (-i -c for tracked) |
Different model |
| Explicit exclude pattern | -x / --exclude <pattern> |
-x / --exclude |
Different model |
| Explicit exclude file | -X / --exclude-from <file> |
-X / --exclude-from |
Different model |
| Pathspec filters | <pathspec>... |
Supported | Different model |
| Unmatched pathspec failure | --error-unmatch |
--error-unmatch |
Different model |
| Line-ending info | --eol (attr/ always empty) |
--eol |
N/A |
| Cached stat block | --debug |
--debug |
flags prints the 16-bit flags word; the v3 extended bits (skip-worktree/intent-to-add) are reflected only by the extended marker, as in Git |
| NUL output | -z (text mode only) |
-z |
Different model |
| Status tags | -t / -v (H/R/C/?/M/S) |
-t / -v (H/S/M/R/C/K/?) |
Different model (-v lowercase assume-unchanged unsupported; K/U unsupported) |
| Unmerged entries | -u / --unmerged |
-u / --unmerged |
Different model |
| Path basis | --full-name (opt-in; cwd-relative by default) |
--full-name |
Same |