Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to diffly are documented here. The format follows [Keep a Ch
### Fixed

- Fast keystroke bursts in the interactive review menu register every press: escape sequences stop at their terminator instead of swallowing neighboring keys.
- `diffly setup` no longer runs the update check twice in a row (once in `main()` and again inside the wizard it launches).
- Pressing an arrow key in the interactive review menu no longer crashes with `NameError: name '_read_escape_sequence' is not defined`; the escape-sequence reader is defined again and a lone Escape still exits without blocking.

## [1.0.0] - 2026-08-22
Expand Down
4 changes: 3 additions & 1 deletion src/diffly_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,9 @@ def main(argv: list[str] | None = None) -> int:
if not effective_argv:
return run_wizard(parser)
args = parser.parse_args(effective_argv)
if args.command not in ("update", "version", "help", "doctor"):
# `setup` ends in the wizard, which runs its own update check; checking
# here too would prompt the user twice in a row.
if args.command not in ("update", "version", "help", "doctor", "setup"):
_check_and_prompt_update()
return args.func(args)

Expand Down
17 changes: 17 additions & 0 deletions tests/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,20 @@ def test_escape_sequence_reader_consumes_exactly_one_sequence(monkeypatch):
finally:
os.close(read_fd)
os.close(write_fd)


def test_setup_delegates_the_update_check_to_the_wizard(monkeypatch):
"""Regression: `diffly setup` used to run the update check twice — once in
main() and again inside the wizard it launches — prompting back to back."""
import diffly_cli.cli as cli

calls: list[str] = []
monkeypatch.setattr(cli, "_check_and_prompt_update", lambda: calls.append("check"))
monkeypatch.setattr(cli, "run_setup", lambda args: 0)
assert cli.main(["setup"]) == 0
assert calls == []

calls.clear()
monkeypatch.setattr(cli, "run_pr", lambda args: 0)
assert cli.main(["pr", "acme/demo", "1"]) == 0
assert calls == ["check"]
Loading