jesseduffield.lazygit/pkg
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
..
app Recognize a repo that has no work tree instead of bailing out 2026-08-08 11:15:01 +02:00
cheatsheet Find the lazygit root directory by go.mod instead of .git 2026-09-09 09:27:44 +02:00
commands Avoid rehydrating unchanged rebase todos 2026-08-29 17:25:59 +02:00
common Move NewDummyCommon to pkg/common 2025-05-06 09:43:26 +02:00
config Validate the context names in the "context" field of custom commands 2026-09-03 21:07:32 +02:00
constants Adapt links 2026-07-31 08:42:51 +02:00
env Remember how to get back to a repo we entered a submodule from 2026-08-08 11:15:01 +02:00
fakes Modernize all codes 2025-11-15 10:46:23 +01:00
gocui Show the search status of what a re-rendered view now holds 2026-09-05 15:09:52 +02:00
gui Render the focused main view again while it is being searched 2026-09-05 15:09:52 +02:00
i18n Update translations from Crowdin 2026-09-05 16:46:18 +02:00
integration Find the lazygit root directory by go.mod instead of .git 2026-09-09 09:27:44 +02:00
jsonschema Find the lazygit root directory by go.mod instead of .git 2026-09-09 09:27:44 +02:00
logs Separate the runs in the debug log with a blank line 2026-08-15 09:48:11 +02:00
snake Remove a few unnecessary parentheses 2026-08-13 20:40:11 +02:00
tasks Hold a task while a view is read to its end 2026-09-05 15:09:52 +02:00
theme Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
updates Change direct access to Common.UserConfig to a getter 2024-08-18 10:24:52 +02:00
utils Find the lazygit root directory by go.mod instead of .git 2026-09-09 09:27:44 +02:00