Skip to content

Should automatic directory changes impact LAZYGIT_NEW_DIR_FILE? #5083

@C0Florent

Description

@C0Florent

Topic

When opening lazygit in a subdirectory of a git repo, it automatically cd's up to the repo root to show a clearer file tree view from the root of the repo. However, this automatic cd does not play well with shell integration (using LAZYGIT_NEW_DIR_FILE) which tells that the current directory has been changed and thus cd's the current shell session to root of the repository.

Your thoughts

This could be worked around by using a more elaborate wrapper than the one currently suggested in the README, but I think, it would be more valuable to not have these kind of automatic cds behave the same way as user-input cds with regards to LAZYGIT_NEW_DIR_FILE.
Of course another alternative is for the user to use the quitWithoutChangingDirectory bind (Q by default) each time they know they haven't changed directory, but I think this should not be up to the user to handle.

Apart from this quirk, I do believe this is a nice feature, I was just very surprised when I found myself magically cd'd to the root of my repository soon after starting to use the wrapper suggested in the readme.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions