jesseduffield.lazygit/pkg/integration/components
Stefan Haller 8b049be31d Find the lazygit root directory by go.mod instead of .git
Running the tests in an exported source tarball fails with "must run in
lazy project folder or child folder". GetLazyRootDirectory searches the
working directory and its parents for a .git directory, and a tarball
doesn't have one. This has always affected the integration tests; since
34da956f5d a unit test calls the function too, so now even
`go test ./... -short` fails.

Search for the go.mod file that declares lazygit's module instead. It
ships in tarballs, and there is exactly one of it per source tree.

Put the function in our own pkg/utils rather than change lazycore's; the
criterion is specific to lazygit, and I don't feel like making a change
to lazycore.

Return an error rather than call log.Fatal, and report it from the two
callers that run under `go test`. In a test binary, log.Fatal exits
without attributing the failure to any test. That is the failure mode
34da956f5d set out to remove. The remaining callers are development
tools that have nothing useful to do without the root directory; they
keep exiting, now through MustFindLazygitRootDirectory.

Also stop the search at the root of the file system rather than at "/".
On Windows the old loop walks up to "C:\" and then spins there forever.
2026-09-09 09:27:44 +02:00
..
alert_driver.go
assertion_helper.go Auto-scroll when dragging to create range selection in staging view 2026-07-31 08:26:35 +02:00
commit_description_panel_driver.go
commit_message_panel_driver.go
common.go Only prompt to continue a rebase/merge if we started it 2026-07-03 18:28:07 +02:00
confirmation_driver.go
env.go Use lo.Map instead of manual append loops 2026-08-16 16:35:11 +02:00
file_system.go
git.go
int_matcher.go
matcher.go
menu_driver.go Filter the keybindings menu as you type 2026-08-31 20:41:22 +02:00
paths.go
popup.go
prompt_driver.go
random.go
runner.go Find the lazygit root directory by go.mod instead of .git 2026-09-09 09:27:44 +02:00
search_driver.go
shell.go Make integration tests using commits more robust 2026-07-09 11:56:27 +02:00
test.go
test_driver.go Add test helpers for a menu's filter row 2026-08-31 20:41:22 +02:00
test_test.go Find the lazygit root directory by go.mod instead of .git 2026-09-09 09:27:44 +02:00
text_matcher.go
view_driver.go Let a test assert how a view draws its selection 2026-09-03 21:19:04 +02:00
views.go Add test helpers for a menu's filter row 2026-08-31 20:41:22 +02:00