-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cleaner dubious ownership error #3881
base: master
Are you sure you want to change the base?
Conversation
- Map dubious ownership error to user-friendly message - Add i18n entry for UnsafeOrNetworkDirectoryError - Capture dubious ownership error in repo_paths Signed-off-by: Kapparina <[email protected]>
@stefanhaller @jesseduffield Please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, couple things
@@ -143,6 +143,10 @@ func callGitRevParseWithDir( | |||
gitCmd := cmd.New(gitRevParse.ToArgv()).DontLog() | |||
res, err := gitCmd.RunWithOutput() | |||
if err != nil { | |||
if strings.Contains(err.Error(), "fatal: detected dubious ownership in repository") { | |||
err = errors.New("fatal: detected dubious ownership in repository") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually the case that the error sometimes contains more than just this string? If so I'd define this string in a constant to be also used in app/errors.go so that it's clear what the connection is.
Whilst there is a solution/workaround, please understand the relevant risks and purpose of this warning! | ||
See 'https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9' for background information on said risks | ||
|
||
This error is unrelated to lazygit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error is unrelated to lazygit | |
This error is unrelated to lazygit. |
Resolves An error occurred! -- Detected dubious ownership in repository #3303, resolves "failed: fatal: detected dubious ownership in repository" when running lazygit on a newly initialized repository on a external drive #3757
Whilst the above issues expect lazygit to prompt the user to prompt whether it should modify their global Git configuration, I believe it is more pertinent that the user instead inform themselves of what's actually going on.
This PR adds a new known error message covering "dubious ownership". Rather than panicking when Git throws such an error, the below error message will be displayed:
Whilst I'm not against contributing to the implementation of the expected behaviour in the aforementioned issues, I think informing users of the risks involved is a necessary starting point.
go generate ./...
)