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 verify-pack

Command reference for `libra verify-pack`

Validate a Git pack index (.idx) against its matching pack archive (.pack).

Synopsis

libra verify-pack [OPTIONS] <IDX_FILE>...

Description

libra verify-pack is a read-only plumbing command. It parses the pack index, decodes the corresponding pack file, and verifies that both files agree on:

  • index version and structural layout
  • fanout table monotonicity and object-name sorting
  • index checksum
  • pack checksum stored in the index trailer
  • object count, object IDs, and offsets
  • CRC32 values for version 2 indexes

By default the pack path is derived by replacing each index file extension with .pack. Use --pack <PACK_FILE> with a single <IDX_FILE> when the pack archive lives elsewhere. The command does not require a Libra repository. When run inside a repository, it uses that repository's object format. Outside a repository, version 2 index files infer SHA-1 vs SHA-256 from the index layout; version 1 indexes are SHA-1 only.

Compatibility note: multiple <IDX_FILE> values are verified in order. --pack cannot be combined with multiple indexes because Git's pack/index naming model does not provide an unambiguous explicit pack for each index.

Options

FlagShortDescriptionDefault
<IDX_FILE>...Pack index file(s) to verifyRequired
--pack <PATH>Pack archive to verify against one index<IDX_FILE> with .pack extension
--verbose-vPrint each indexed object using Git-compatible verbose fieldsOff
--stat-only-sPrint only Git-style non-delta and delta-chain statisticsOff
--jsonEmit a structured JSON envelopeOff
--machineEmit the same envelope as one compact JSON lineOff

Examples

libra verify-pack objects/pack/pack-abc123.idx
libra verify-pack pack-a.idx pack-b.idx
libra verify-pack --pack /tmp/pack-abc123.pack /tmp/pack-abc123.idx
libra verify-pack -v pack-abc123.idx
libra verify-pack -s pack-abc123.idx
libra verify-pack pack-abc123.idx --json

Human Output

Successful non-verbose verification prints one summary line per index:

objects/pack/pack-abc123.idx: ok
objects/pack/pack-def456.idx: ok

Verbose mode prints indexed objects before the summary line using Git's base field layout:

3b18e512dba79e4c8300dd08aeb37f8e728b8dad blob 12 21 48
objects/pack/pack-abc123.idx: ok

The fields are <oid> <type> <size> <size-in-pack> <offset>. CRC32 values for version 2 indexes are validated and remain available in structured output, but are not printed in human verbose mode.

Stat-only mode prints Git-style aggregate statistics and omits the trailing : ok line:

non delta: 42 objects
chain length = 1: 3 objects

Structured Output

{
  "ok": true,
  "command": "verify-pack",
  "data": {
    "idx_file": "objects/pack/pack-abc123.idx",
    "pack_file": "objects/pack/pack-abc123.pack",
    "index_version": 2,
    "object_count": 42,
    "pack_hash": "0123456789abcdef0123456789abcdef01234567",
    "index_hash": "89abcdef0123456789abcdef0123456789abcdef",
    "verified": true
  }
}

When --verbose is combined with --json, data.objects[] contains oid, object_type, size, size_in_pack, offset, and optional crc32. When --stat-only is combined with --json, data.stats contains non_delta and any chain_lengths.

For multiple indexes, structured output wraps per-index results:

{
  "ok": true,
  "command": "verify-pack",
  "data": {
    "verified": true,
    "count": 2,
    "results": [
      {
        "idx_file": "pack-a.idx",
        "pack_file": "pack-a.pack",
        "index_version": 1,
        "object_count": 42,
        "pack_hash": "0123456789abcdef0123456789abcdef01234567",
        "index_hash": "89abcdef0123456789abcdef0123456789abcdef",
        "verified": true
      },
      {
        "idx_file": "pack-b.idx",
        "pack_file": "pack-b.pack",
        "index_version": 1,
        "object_count": 42,
        "pack_hash": "fedcba9876543210fedcba9876543210fedcba98",
        "index_hash": "76543210fedcba9876543210fedcba9876543210",
        "verified": true
      }
    ]
  }
}

Compatibility

FeatureLibraGitjj
Verify pack indexlibra verify-pack <idx>...git verify-pack <idx>...N/A
Verbose objects-v / --verbose-vN/A
Stat-only mode-s / --stat-only-s / --stat-onlyN/A
Explicit pack path--pack <path>N/AN/A
JSON output--json / --machineN/AN/A
Version 1 indexSupported for SHA-1 repositoriesSupportedN/A
Version 2 indexSupportedSupportedN/A

Error Handling

ScenarioStableErrorCodeExit
Index file cannot be openedLBR-IO-001128
Pack file cannot be openedLBR-IO-001128
Index is malformedLBR-REPO-002128
Pack is malformedLBR-REPO-002128
Index and pack disagreeLBR-REPO-002128
--pack used with multiple indexesLBR-CLI-002129

libra usage

Command reference for `libra usage`

libra whoami

Command reference for `libra whoami`

On this page

SynopsisDescriptionOptionsExamplesHuman OutputStructured OutputCompatibilityError Handling