-
-
Notifications
You must be signed in to change notification settings - Fork 111
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 git root inside a git repo #111
Conversation
Wow, amazing. I'll check it later |
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.
LGTM!
Sorry for the late response and thank you for the contribution! Could you fix the conflicts? |
Slight request for improvement, can we change it so that it doesn't show if you're at the git root dir? |
@@ -0,0 +1,8 @@ | |||
__enhancd::entry::git::root() | |||
{ | |||
if git rev-parse --is-inside-work-tree 2> /dev/null && [[ $(git rev-parse --show-toplevel) != $PWD ]]; then |
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.
I suggest to quote the $(git rev-parse --show-toplevel)
and $PWD
to prevent issues with spaces in dir/file names
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.
According to the bash manual,
Word splitting and filename expansion are not performed on the words between the [[ and ]]
So i don't think it's necessary
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.
Cool! Didn't know that.
Thanks for the update @gazorby! |
Any update on this? |
@hoshsadiq We should probably merge #139 first and then come back to this. |
WHAT
Inside a git repository (either at root or under sub directories), the list is shifted towards the bottom so the first element become the git root folder of the repository.
Support has been added for both zsh and fish.
WHY
#110