Skip to content

Conversation

@jordpo
Copy link

@jordpo jordpo commented Oct 20, 2025

Summary

Implements a new icechunk ref list command that displays all branches and tags in an Icechunk repository, providing Git-style reference listing functionality from the CLI.

Fixes #827

Motivation

Users need a convenient way to view all references (branches and tags) in their Icechunk repositories from the command line, similar to git show-ref or git branch -a. Currently, this requires using the Python API, which is less convenient for quick repository inspection.

Approach

This PR adds a new ref subcommand to the Icechunk CLI with a list operation that:

  1. Follows existing patterns: Implemented similarly to existing commands like snapshot list and config list
  2. Leverages existing APIs: Uses Repository::list_branches() and Repository::list_tags() methods that are already available in the Rust codebase
  3. Clean output format: Displays references in a clear format:
    branch: main
    branch: feature
    tag: v1.0
    

Changes

  • Added Ref(RefCommand) variant to the CLI Command enum
  • Created RefCommand enum with List(RefListCommand) subcommand
  • Implemented ref_list() handler function that:
    • Opens the repository from config
    • Retrieves all branches and tags
    • Formats output with clear labels
  • Wired up the command in the run_cli() executor
  • Added comprehensive test coverage

Test Coverage

Added test_ref_list() integration test that:

  • Creates a test repository with the main branch
  • Adds an additional branch (feature) and tag (v1.0)
  • Verifies all references appear in the output
  • Validates output format and line count

Test passes with:

cargo test --lib --features cli cli::interface::tests::test_ref_list

Usage

# List all references in a repository
icechunk ref list <repository-alias>

# Example output:
# branch: main
# branch: feature-x
# tag: v1.0.0
# tag: v2.0.0-beta

Testing

Manually tested with:

cargo build --features cli
./target/debug/icechunk ref --help
./target/debug/icechunk ref list --help

All existing CLI tests continue to pass.

🤖 Generated with Claude Code

jordpo and others added 2 commits October 20, 2025 10:05
Implements a new `icechunk ref list` command that displays all branches
and tags in an Icechunk repository, similar to `git show-ref`.

This addresses the need for users to easily view all references in a
repository from the command line without needing to use the Python API.

Changes:
- Add `ref` subcommand with `list` operation to CLI
- Implement `ref_list()` handler that calls Repository::list_branches()
  and Repository::list_tags()
- Format output as `branch: <name>` and `tag: <name>` for clarity
- Add comprehensive test that creates repository with multiple branches
  and tags and verifies correct output

Test coverage:
- Added `test_ref_list()` that creates a repo with main branch, feature
  branch, and v1.0 tag, then verifies all refs appear in output
- Test passes with `cargo test --lib --features cli`

Fixes earth-mover#827

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: List Refs

1 participant