LibraLibra
LibraLibra
DocsBlogLibra
Getting Started
Architecture
Design
Commands
libra addlibra agentlibra alternateslibra applylibra archivelibra authlibra automationlibra bisectlibra blamelibra branchlibra bundlelibra cachelibra cat-filelibra check-attrlibra check-ignorelibra check-mailmaplibra checkoutlibra cherry-picklibra cleanlibra clonelibra cloudlibra code-controllibra codelibra commit-treelibra commitlibra completionslibra configlibra credentiallibra depslibra describelibra diff-fileslibra diff-indexlibra diff-treelibra difflibra dirtylibra fast-exportlibra fast-importlibra fetchlibra filelibra for-each-reflibra format-patchlibra fscklibra gclibra graphlibra greplibra hash-objectlibra hookslibra hydratelibra index-packlibra initlibra investigatelibra layerlibra lfslibra loglibra logfilelibra loginlibra logoutlibra ls-fileslibra ls-remotelibra ls-treelibra maintenancelibra medialibra merge-baselibra merge-filelibra mergelibra metadatalibra mvlibra noteslibra oplibra openlibra pack-objectslibra packagelibra prunelibra publishlibra pulllibra pushlibra read-treelibra rebaselibra refloglibra remotelibra repacklibra replacelibra rererelibra resetlibra restorelibra rev-listlibra rev-parselibra revertlibra reviewlibra revisionlibra rmlibra sandboxlibra servicelibra shortloglibra show-reflibra showlibra sparse-viewlibra stashlibra statslibra statuslibra switchlibra symbolic-reflibra taglibra update-indexlibra update-reflibra usagelibra verify-packlibra whoamilibra worktreelibra write-tree
API Reference
Policy
Commands

libra ls-tree

Command reference for `libra ls-tree`

List the contents of a tree object.

Synopsis

libra ls-tree [OPTIONS] <TREE-ISH> [PATH...]

Description

libra ls-tree resolves <TREE-ISH> to a commit root tree or to a tree object hash, then prints entries from that tree. When invoked from a subdirectory, paths and output are relative to that subdirectory by default. It is read-only: it does not update refs, the index, the worktree, or object storage.

The current compatibility slice supports ordinary path prefix filters, --full-name, --full-tree, REV:path tree-ish syntax (resolve a revision and navigate into a subtree, e.g. HEAD:src), and --format. Full Git pathspec magic is deferred.

Options

FlagDescription
-r, --recursiveRecurse into subtrees
-tShow tree entries while recursing
-dShow matching tree entries themselves rather than their children
-l, --longShow blob sizes; tree and commit entries use -
-zTerminate records with NUL instead of newline
--name-onlyPrint only entry paths
--name-statusGit-compatible alias that prints only entry paths
--object-onlyPrint only object IDs
--full-namePrint paths relative to the repository root when invoked from a subdirectory
--full-treeList from the repository root and interpret path filters relative to the repository root
--abbrev[=<N>]Abbreviate object IDs to N characters, or 7 when N is omitted
<TREE-ISH>Commit, branch, tag, HEAD, or tree object hash
[PATH...]Optional path prefix filters; relative to the current directory unless --full-tree is set

Examples

libra ls-tree HEAD
libra ls-tree HEAD:src
libra ls-tree HEAD:src/nested
libra ls-tree -r HEAD src
libra ls-tree -l HEAD README.md
libra ls-tree --name-only HEAD src
libra ls-tree --full-name HEAD
libra ls-tree --full-tree HEAD
libra ls-tree --object-only --abbrev HEAD
libra ls-tree -z HEAD
libra --json ls-tree HEAD

Human Output

Default output matches Git's common shape:

100644 blob 4f3c2d1a7b8c9d0e1234567890abcdef12345678	README.md
040000 tree 5a6b7c8d9e0f1234567890abcdef1234567890	src

With -l, blob entries include their decoded object size:

100644 blob 4f3c2d1a7b8c9d0e1234567890abcdef12345678      128	README.md
040000 tree 5a6b7c8d9e0f1234567890abcdef1234567890        -	src

Structured Output

With --json, output uses the standard command envelope. With -l, blob entries include the size field:

{
  "ok": true,
  "command": "ls-tree",
  "data": {
    "treeish": "HEAD",
    "root_tree": "5a6b7c8d9e0f1234567890abcdef1234567890",
    "recursive": false,
    "entries": [
      {
        "mode": "100644",
        "object_type": "blob",
        "object": "4f3c2d1a7b8c9d0e1234567890abcdef12345678",
        "path": "README.md",
        "size": 128
      }
    ]
  }
}

Parameter Comparison: Libra vs Git vs jj

FeatureLibraGitjj
Commit/tree listingSupportedSupportedUse file/revset commands
Recursive listing-r / --recursive-rDifferent model
Tree entries while recursive-t-tDifferent model
Subdirectory outputCurrent-directory relative; --full-name keeps repository pathsSupportedDifferent model
Root-scoped listing--full-tree--full-treeDifferent model
Path filtersPrefix filters only; current-directory relative unless --full-tree is setFull pathspecRevset/file patterns
Custom formattingDeferred--formatDifferent model
JSON output--jsonNoNo

Error Handling

ScenarioStableErrorCodeExit
Invalid or missing tree-ishLBR-CLI-003129
REV:path targets a blob (not a tree)LBR-CLI-003128
Failed to read objectsLBR-IO-001128
Corrupt stored refs/objectsLBR-REPO-002128

libra ls-remote

Command reference for `libra ls-remote`

libra maintenance

Command reference for `libra maintenance`

On this page

SynopsisDescriptionOptionsExamplesHuman OutputStructured OutputParameter Comparison: Libra vs Git vs jjError Handling