Skip to content

fix(changes): compact single-child folders - #77

Open
BenLocal wants to merge 1 commit into
the0807:mainfrom
BenLocal:fix/changes-tree-compact-folders
Open

fix(changes): compact single-child folders#77
BenLocal wants to merge 1 commit into
the0807:mainfrom
BenLocal:fix/changes-tree-compact-folders

Conversation

@BenLocal

Copy link
Copy Markdown

Summary

Improve the Changes sidebar by displaying deep single-child directory chains in VS Code-style compact folders.

For example:

src
  main
    java
      App.java

is now displayed as:

src / main / java
  App.java

## Changes

- Compact consecutive directories when each directory has only one child directory.
- Stop compacting at directory branches or when a directory also contains files.
- Preserve the deepest real directory path for:
    - Expand and collapse
    - Folder selection
    - Patch creation
    - Stash restoration

- Truncate long folder labels while exposing the full path through the native tooltip.
- Use iterative chain folding to avoid stack overflow on pathological deep paths.
- Apply the same behavior to committed, staged, unstaged, compare, and stash views.

## Testing

Added regression coverage for:

- Single-child directory chains
- Directory branches
- Directories containing both files and subdirectories
- Staged and unstaged changes
- Folder expand/collapse
- Folder patch paths
- A pathological 3,000-level directory chain

Validation results:

- 126 test files passed
- 1,879 tests passed, 9 skipped
- Statement coverage: 98.01%
- Branch coverage: 90.39%
- TypeScript check passed
- Svelte check passed with 0 errors and 0 warnings
- Production build passed
- Dependency audit reported 0 vulnerabilities

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.

1 participant