Skip to content
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

Not working properly with $GIT_DIR and $GIT_WORK_TREE environment vars #3010

Closed
intrntbrn opened this issue Sep 13, 2023 · 2 comments
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@intrntbrn
Copy link

intrntbrn commented Sep 13, 2023

Lazygit is messed up when $GIT_DIR and $GIT_WORK_TREE is defined and not launched with --git-dir and --work-tree arguments.

Commits and files are displayed correctly but it's not possible to stage a file (or to run other commands), because the work-tree prefix is missing in the file's path (e.g. it tries to run git add file instead of git add worktree/file because worktree is undefined)

The issue can be fixed by explicitly defining the arguments: lazygit --git-dir=$GIT_DIR --work-tree=$GIT_WORK_TREE.

@intrntbrn intrntbrn added the bug Something isn't working label Sep 13, 2023
@intrntbrn intrntbrn changed the title Not working properly with # Not working properly with $GIT_DIR and $GIT_WORK_TREE environment vars Sep 13, 2023
@jesseduffield
Copy link
Owner

This should be an easy fix i.e. in

} else if cliArgs.WorkTree != "" {
we need to Chdir to the worktree path when the CLI arg is passed or when the env var is set.

Would you be up to raising a PR for this @intrntbrn ?

@jesseduffield jesseduffield added the good first issue Good for newcomers label Sep 25, 2023
@intrntbrn
Copy link
Author

#3024 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants