Skip to content

fix: add missing context to hook show outside git repo - #1809

Merged
max-sixty merged 2 commits into
max-sixty:mainfrom
noirbizarre:fix/hook-show-outside-git-repo
Mar 30, 2026
Merged

max-sixty merged 2 commits into
max-sixty:mainfrom
noirbizarre:fix/hook-show-outside-git-repo

Conversation

@noirbizarre

Copy link
Copy Markdown
Contributor

Summary

  • Add .context("Failed to show hooks") to Repository::current() in handle_hook_show, matching the pattern used by remove and switch commands
  • Add git "not a git repo" message filter to setup_home_snapshot_settings() to normalize across environments (local machines produce a two-line message with "filesystem boundary", CI/Docker produce a single-line variant)
  • Re-accept affected snapshots with the normalized [GIT_DISCOVERY_MSG] placeholder

Root cause: When wt hook show runs outside a git repo, Repository::current() returns an error without .context(). On systems where git produces a multi-line error message, this hits the debug_assert! at src/main.rs:1064 ("Multiline error without context"), causing exit code 101 (panic) instead of exit code 1 (clean error).

Depends on #1808.

- Replace sort_by closure with sort_by_key + Reverse for clippy
- Add thread ID regex filter to hook_show snapshot settings to
  prevent flakiness from varying thread IDs in panic messages
- Add .context("Failed to show hooks") to Repository::current() in
  handle_hook_show, matching the pattern used by remove and switch
- Add git "not a git repo" message filter to setup_home_snapshot_settings
  to normalize across environments (local vs CI produce different text)
- Re-accept affected snapshots with normalized git messages
@max-sixty
max-sixty merged commit 0d809de into max-sixty:main Mar 30, 2026
23 checks 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.

3 participants