You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have an issue when using starship on a slow network drive with git modules (git_branch, git_state, etc) enabled.
Example path of a slow drive /mnt/slow/drive which does not contain any git repos.
I often cd into a deep nested directory like /mnt/slow/drive/some/nested/dir. With git modules
disabled, starship works pretty well but hangs when they are enabled.
Describe the solution you'd like
I want a way to conditionally disable git modules in specific directories.
As far as I can tell, there are 2 ways it can be accomplished:
I submitted Remove reset of match_ceiling_dir_or_error in apply_environment() Byron/gitoxide#1191 to gitoxide which should allow starship conditionally enable the flag match_ceiling_dir_or_error = true. I propose creating a new global config in starship which enables the flag. Users who want this feature then will be able to define GIT_CEILING_DIRECTORIES={list of whitelisted git dirs} which does not include /mnt/slow/drive.
Another approach is defining configs similar to detect_folders for all git modules as described in https://starship.rs/config/#negative-matching. The desired behaviour will not be exactly the same as detect_folders because those filters usually need at least a single positive match for the module to be enabled. What I need is some way to blacklist specific directories and if not blacklisted, continue with regular logic of walking up the parent dir. If using that approach the config will probably need to be renamed to something else to avoid confusion with detect_folders.
I am willing to contribute a PR for resolving this and opening this issue to start a discussion on the best approach.
The text was updated successfully, but these errors were encountered:
Another option would be to make each module get enabled/disabled via an env variable (e.g. STARSHIP_CONFIG__GIT_STATUS__DISABLED=true) and you could set this via direnv or some other magic.
This pr implements such an idea, but it's currently stuck: #4439
Thanks for the pointers. Ideally I would like to have this feature implemented without external tools. I don't use direnv but might consider switching to it if the other PR is merged.
While i can strongly recommend direnv for project setups per dir, you can get the same effect with a "cd" function in your bashrc/zshrc which would first check on which dir you are and then either set or unset the end var and then call "builtin cd". Or if you are in zsh with a precmd function.
Feature Request
Is your feature request related to a problem? Please describe.
I have an issue when using
starship
on a slow network drive withgit
modules (git_branch
,git_state
, etc) enabled.Example path of a slow drive
/mnt/slow/drive
which does not contain any git repos.I often
cd
into a deep nested directory like/mnt/slow/drive/some/nested/dir
. Withgit
modulesdisabled,
starship
works pretty well but hangs when they are enabled.Describe the solution you'd like
I want a way to conditionally disable git modules in specific directories.
As far as I can tell, there are 2 ways it can be accomplished:
I submitted Remove reset of
match_ceiling_dir_or_error
inapply_environment()
Byron/gitoxide#1191 togitoxide
which should allowstarship
conditionally enable the flagmatch_ceiling_dir_or_error = true
. I propose creating a new global config instarship
which enables the flag. Users who want this feature then will be able to defineGIT_CEILING_DIRECTORIES={list of whitelisted git dirs}
which does not include/mnt/slow/drive
.With those configs,
starship
will not be walking up the dirs to detect repo roots when in non-whitelisted dirs. You can see some discussion on this approach in chore(context): explicitly avoid erroring on no git-ceiling-dir-match #5645Another approach is defining configs similar to
detect_folders
for all git modules as described in https://starship.rs/config/#negative-matching. The desired behaviour will not be exactly the same asdetect_folders
because those filters usually need at least a single positive match for the module to be enabled. What I need is some way to blacklist specific directories and if not blacklisted, continue with regular logic of walking up the parent dir. If using that approach the config will probably need to be renamed to something else to avoid confusion withdetect_folders
.I am willing to contribute a PR for resolving this and opening this issue to start a discussion on the best approach.
The text was updated successfully, but these errors were encountered: