Files
Adam Jeniski 52a1054757 Sort branches by commit date like lazygit
Use git for-each-ref with --sort=-committerdate to order branches by
last commit date (newest first), matching lazygit's default behavior.
Added e2e test with controlled commit dates to verify ordering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:14:22 -05:00

67 lines
1.5 KiB
VHS

# VHS E2E test for lazygitclj - Branch ordering by commit date
# Tests that branches are sorted by commit date (newest first) like lazygit
#
# Setup creates branches with specific commit dates:
# - main: 2024-01-04 (newest)
# - gamma-branch: 2024-01-03
# - beta-branch: 2024-01-02
# - alpha-branch: 2024-01-01 (oldest)
#
# Expected order in UI (by date): main, gamma-branch, beta-branch, alpha-branch
# Alphabetical order would be: alpha-branch, beta-branch, gamma-branch, main
Output test/e2e/output/branch-order.gif
Output test/e2e/output/branch-order.ascii
Require bb
Set Shell "bash"
Set FontSize 14
Set Width 1000
Set Height 600
Set Framerate 10
# Setup test repo with branches having different commit dates
Type "cd /home/ajet/repos/lazygitclj && bb e2e:setup-branch-order"
Enter
Sleep 1s
# Run lazygitclj in the test repo
Type "cd /tmp/lazygitclj-e2e-branch-order && bb --config /home/ajet/repos/lazygitclj/bb.edn start"
Enter
Sleep 2s
# Switch to Branches panel (panel 3)
Type "3"
Sleep 500ms
# The branches panel should show branches in date order:
# gamma-branch (newest), beta-branch, alpha-branch, main (oldest)
# Take a moment to verify the order visually
Sleep 2s
# Navigate down through the branches to verify order
Type "j"
Sleep 300ms
Type "j"
Sleep 300ms
Type "j"
Sleep 300ms
# Navigate back up
Type "k"
Sleep 300ms
Type "k"
Sleep 300ms
Type "k"
Sleep 300ms
# Quit
Type "q"
Sleep 1s
# Cleanup test repo
Type "cd /home/ajet/repos/lazygitclj && bb e2e:cleanup-branch-order"
Enter
Sleep 500ms