Skip to content

feat: add optional size column with summary footer#315

Merged
avihut merged 3 commits intomasterfrom
feat/size--column
Mar 17, 2026
Merged

feat: add optional size column with summary footer#315
avihut merged 3 commits intomasterfrom
feat/size--column

Conversation

@avihut
Copy link
Owner

@avihut avihut commented Mar 17, 2026

Summary

  • Add a new size column showing the disk size of each worktree folder in human-readable format (e.g. 42K, 1.3M, 2.5G)
  • Not shown by default — must be explicitly enabled via --columns +size
  • When visible, a summary footer row displays the total size across all worktrees
  • Works across all three UI commands: list, sync, and prune

Details

The column sits at canonical position 4 (after Path, before Base). Size computation:

  • Recursively walks the worktree directory summing file sizes
  • Tracks inodes to count hard-linked files only once (matching du behavior)
  • Uses symlink_metadata to avoid following symlinks
  • Skips unreadable files gracefully instead of aborting

JSON output wraps in {"worktrees": [...], "total_size_bytes": N, "total_size": "X.YG"} when size is selected, preserving backward compatibility when it's not.

Shell completions updated for all four shells (also fixes missing owner entries).

Test plan

  • cargo clippy — zero warnings
  • cargo test — 663 passed, 0 failed
  • cargo fmt — clean
  • Man pages regenerated
  • Manual: git worktree-list --columns +size shows Size column after Path with summary footer
  • Manual: git worktree-list (default) does not show Size column
  • Manual: git worktree-list --columns +size --json wraps output with total
  • Manual: daft sync --columns +size shows size in TUI
  • Manual: daft prune --columns +size shows size in TUI

🤖 Generated with Claude Code

Add a new `size` column showing the disk size of each worktree folder in
human-readable format (e.g. 42K, 1.3M, 2.5G). The column is not shown by
default — it must be explicitly enabled via `--columns +size`.

When present, a summary footer row displays the total size across all
worktrees. The column appears after Path (canonical position 4) and works
across list, sync, and prune commands.

Size computation uses inode tracking to count hard-linked files only once
(matching `du` behavior) and uses symlink_metadata to avoid following
symlinks. Unreadable files are silently skipped for resilience.

Shell completions updated for all four shells (also adds missing `owner`).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avihut avihut added this to the Public Launch milestone Mar 17, 2026
@avihut avihut added the feat New feature label Mar 17, 2026
@avihut avihut self-assigned this Mar 17, 2026
avihut and others added 2 commits March 18, 2026 00:18
Add size to valid column names, document it as optional (not in defaults),
and add +size example to modifier mode section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The summary footer now subtracts pruned worktrees from the total,
so the displayed size updates as worktrees are removed during
sync and prune operations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avihut avihut merged commit cda526f into master Mar 17, 2026
8 checks passed
@avihut avihut deleted the feat/size--column branch March 17, 2026 22:41
This was referenced Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant