jesseduffield.lazygit/pkg/gui/controllers
Stefan Haller b76c1072ff Offer direnv .envrc approval from inside lazygit
When a user switches into a repo whose .envrc hasn't been approved with
`direnv allow`, the previous behavior was to drop a "blocked" error
popup and leave the user to fix it externally. That meant opening a
terminal, running `direnv allow`, and then either restarting lazygit or
switching repos and back to refresh the env — easy to get wrong, easy
to forget.

When `direnv export json` exits non-zero, follow up with `direnv status
--json` to ask direnv whether the current directory has a not-yet-
allowed .envrc, and if so, get its path. Then show a confirmation popup
with the .envrc contents inline so the user can read what they're
approving. Confirming runs `direnv allow <path>` and re-runs the load
so the new env reaches subprocesses immediately; cancelling leaves the
env unloaded (the same state as before this commit when direnv refused
to load the .envrc).

Using `direnv status --json` instead of parsing the "is blocked"
stderr line means we rely on direnv's structured output rather than
its human-readable error format, which is more stable across versions
and avoids assumptions about output formatting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 09:05:01 +02:00
..
helpers Offer direnv .envrc approval from inside lazygit 2026-06-04 09:05:01 +02:00
attach.go Add OnQuit hook for controllers 2026-04-21 11:25:29 +02:00
base_controller.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
basic_commits_controller.go Convert keybinding fields to Keybinding 2026-05-25 15:32:47 +02:00
bisect_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
branches_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
command_log_controller.go Remove return value of Focus-related functions 2024-09-06 08:45:48 +02:00
commit_description_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
commit_message_controller.go Convert keybinding fields to Keybinding 2026-05-25 15:32:47 +02:00
commits_files_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
common.go lots of changes 2023-04-30 13:19:53 +10:00
confirmation_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
context_lines_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
custom_patch_options_menu_action.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
diffing_menu_action.go Remove TrimSpace calls that are no longer needed 2025-11-15 15:38:24 +01:00
files_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
filter_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
filtering_menu_action.go Remove TrimSpace calls that are no longer needed 2025-11-15 15:38:24 +01:00
git_flow_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
global_controller.go Refresh main view when cycling pagers with main view focused 2026-05-26 07:58:50 +02:00
jump_to_side_window_controller.go Convert JumpToBlock to a list of multi-key bindings 2026-05-25 15:32:47 +02:00
list_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
list_controller_trait.go Enable nolintlint linter, and fix warnings 2025-06-30 18:30:11 +02:00
local_commits_controller.go Convert keybinding fields to Keybinding 2026-05-25 15:32:47 +02:00
local_commits_controller_test.go Move isFixupCommit to FixupHelper 2026-01-24 16:04:35 +01:00
main_view_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
menu_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
menu_key.go Use a slice of keys for each binding 2026-05-25 15:18:18 +02:00
merge_conflicts_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
options_menu_action.go If a menu entry has multiple keybindings, list them in a tooltip 2026-05-25 15:32:47 +02:00
patch_building_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
patch_explorer_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
patch_explorer_controller_test.go Strip the '+' and '-' characters when copying parts of a diff to the clipboard 2025-04-29 11:33:47 +02:00
prompt_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
quit_actions.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
reflog_commits_controller.go Fix showing diffs for renamed file when filtering by path 2025-07-27 12:05:41 +02:00
remote_branches_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
remotes_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
remotes_controller_test.go feat: add fork remote command 2025-11-16 17:26:00 +01:00
rename_similarity_threshold_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
screen_mode_actions.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
scroll_off_margin.go Replace min/max helpers with built-in min/max 2024-04-07 23:24:10 +08:00
scroll_off_margin_test.go Add tests for scroll-off margin of zero 2023-08-21 08:10:28 +02:00
search_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
search_prompt_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
shell_command_action.go Strip leading/trailing whitespace from prompt input 2025-11-15 15:38:24 +01:00
side_window_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
snake_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
staging_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
stash_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
status_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
sub_commits_controller.go Use async refresh rather than manual OnWorker call 2025-07-02 16:10:04 +02:00
submodules_controller.go Convert keybinding fields to Keybinding 2026-05-25 15:32:47 +02:00
suggestions_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
switch_to_diff_files_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
switch_to_focused_main_view_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
switch_to_sub_commits_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
sync_controller.go Convert keybinding fields to Keybinding 2026-05-25 15:32:47 +02:00
tags_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
toggle_whitespace_action.go Move IgnoreWhitespaceInDiffView to user config 2025-07-09 13:15:03 +02:00
undo_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
vertical_scroll_controller.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
view_selection_controller.go Fold remaining alt bindings into their main fields 2026-05-25 15:32:47 +02:00
workspace_reset_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
worktree_options_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00
worktrees_controller.go Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem 2026-05-25 15:18:18 +02:00