Skip to content

fix: resolve state command parsing, ordering, and edge cases#77

Merged
Huerte merged 1 commit into
mainfrom
fix/state-command-parsing-and-ordering
May 31, 2026
Merged

fix: resolve state command parsing, ordering, and edge cases#77
Huerte merged 1 commit into
mainfrom
fix/state-command-parsing-and-ordering

Conversation

@Huerte
Copy link
Copy Markdown
Owner

@Huerte Huerte commented May 31, 2026

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactor / internal

Overview

this fixes several bugs with the gitgo state command. the parser now handles aliases correctly, the display order is fixed to show chronological order, and some missing guards and edge cases are now covered.

Changes

  • gitgo state: fixed argparse rejecting short-form aliases like -l and -s.
  • gitgo state list: fixed states displaying in reverse chronological order. they now print oldest to newest with 1, 2, 3 numbering.
  • internal: updated the math so visual IDs map to the correct git stash index under the hood.
  • gitgo state: patched a crash that happened when git outputs dates instead of indices for stash refs.
  • gitgo state load: added a guard to prevent loading when no states exist.
  • gitgo state: added validation to reject conflicting inputs like gitgo state list -s.
  • gitgo state delete: locked the -a and --all flags strictly to the delete action so they aren't accepted elsewhere.

How to Test

  1. pip install -e ".[dev]"
  2. run gitgo state save 'test state' and then gitgo state list.
  3. Expected result: the state is saved, the list command doesn't crash, and it prints with ID 1.
  4. run pytest tests/
  5. Expected result: all tests pass successfully.

Checklist

  • I tested my changes locally and they work
  • I updated CHANGELOG.md under the [Unreleased] section
  • I updated README.md (if I added or changed a command)
  • I added or updated tests for my change (if applicable)
  • My change does not break any existing commands (if it does, describe the impact in the Overview)

@Huerte Huerte merged commit 81983e3 into main May 31, 2026
1 check passed
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