Skip to content

Added zsh support#15

Closed
Ondkloss wants to merge 3 commits into
fabriziocucci:masterfrom
Ondkloss:feature-zsh
Closed

Added zsh support#15
Ondkloss wants to merge 3 commits into
fabriziocucci:masterfrom
Ondkloss:feature-zsh

Conversation

@Ondkloss

@Ondkloss Ondkloss commented Oct 2, 2020

Copy link
Copy Markdown

Added zsh support. Now attaches to both .bash_profile and .zshrc.
This should be useful for newest MacOS versions as zsh is now the default.

@ale-diez

Copy link
Copy Markdown

It produces the following warning when opening a new terminal window:

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]? ccompinit: initialization aborted
$ compaudit
There are insecure directories:
/usr/local/share/zsh/site-functions
/usr/local/share/zsh

macOS Catalina 10.15.7

$ git --version
git version 2.24.3 (Apple Git-128)

@Ondkloss

Copy link
Copy Markdown
Author

Thanks for the info @demedos! Appears to happen if some folders would be made accessible through "less than ideal" permission settings. Quote:

For security reasons compinit also checks if the completion system would use files not owned by root or by the current user, or files in directories that are world- or group-writable or that are not owned by root or by the current user. If such files or directories are found, compinit will ask if the completion system should really be used. To avoid these tests and make all files found be used without asking, use the option -u, and to make compinit silently ignore all insecure files and directories use the option -i. This security check is skipped entirely when the -C option is given.

I think it would make sense to add the -i flag to avoid this output and not use those folders. I'll probably add that as a commit.

@ale-diez

Copy link
Copy Markdown

Cool, adding it to the ~/.git-bash-for-mac-zsh.sh works, but could that be a security issue?

@Ondkloss

Copy link
Copy Markdown
Author

@demedos the way I read it (in no way being an expert on the command):
The -u flag could be a security issue since it silently includes.
On the other hand the -i should be safer, since it silently ignores.

I'll probably spend some more time looking into it before doing a commit though!

Now uses zsh build in completion.
Chose not to use zsh built in VCS info to keep env var support.
Lots of advice found at: https://git-scm.com/book/sv/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh
@Ondkloss

Copy link
Copy Markdown
Author

I've updated the zsh functionality to remove what I now figure to be not necessary. Now uses zsh built in completion for git. Chose to skip using built in VCS info to keep env_var support and keep it the same for both bash and zsh.

Regarding the compinit messages listed by @demedos, from reading this StackOverflow question I didn't dare to add the -i flag. I still figure this to be the safe choice of flags, but it seems the correct thing to do is actually address the owner/permissions for the directories that cause the issue.

I'd love for someone to still try this thing out, although I've "confirmed it is working on my computer" 🤓

@ale-diez

ale-diez commented Nov 26, 2020

Copy link
Copy Markdown

Nice, on my machine it works too 😂

Let's mention that potential issue on the README with some hint about it, as seen here:

https://stackoverflow.com/a/22753363

@Ondkloss mind taking over the repo so that we can merge some pull request?

@Ondkloss

Copy link
Copy Markdown
Author

@demedos what exactly do you mean by taking over? In any case I'll be very happy to assist in merging etc.

@ale-diez

Copy link
Copy Markdown

It seems like @fabriziocucci has abandoned this repo.
What do you think about creating a new one with the updates?

@Ondkloss

Ondkloss commented Nov 30, 2020

Copy link
Copy Markdown
Author

@demedos currently I'm working directly on my fork. I'm not sure if a brand new repo would help? I could easily add you to my fork, if you feel like that is the way to go. Being a fork it sort of pays tribute to the origin, as well as maybe channeling some of those finding this repo onward.

@ale-diez

ale-diez commented Dec 1, 2020

Copy link
Copy Markdown

@Ondkloss Yes I was talking about creating a new repo with reference to this one on the first lines of the README for credits.
That could address new users looking for a working solution which may find hard to reach your repo otherwise; either way it's ok to me as long as your code contains all the updates :)

Comment thread .git-bash-for-mac-zsh.sh
Explicitly set `setopt PROMPT_SUBST` to allow command substitution.
@verlok

verlok commented Mar 6, 2022

Copy link
Copy Markdown

@fabriziocucci what do you think? Can we merge?

@ale-diez

ale-diez commented Mar 7, 2022

Copy link
Copy Markdown

@fabriziocucci what do you think? Can we merge?

This repo is not maintained anymore, you better install it from the @Ondkloss fork
https://github.com/Ondkloss/git-bash-for-mac#install

@fabriziocucci

Copy link
Copy Markdown
Owner

Hello everyone, happy to merge this today! 🙂

@demedos is right, I've left this untouched for quite sime time, probably since zsh has become the default shell for macOS, which somehow pushed me away from this lightweight solution and towards more heavyweight alternatives (e.g. Oh My Zsh).

I'd be curios to know form the people using this today, what are your main motivations?

@verlok

verlok commented Mar 7, 2022

Copy link
Copy Markdown

Hey @fabriziocucci,

the thing is this repo appears in the google SERP when you search for something like "git integration shell" or "git bash integration" or "git bash mac". So eventually people ends up here before even reading about the existence of Oh My Zsh.

That's where I was when I commented above.

After searching for a while with different search strings, I ended up in a page in the git website where Oh My Zsh is mentioned and how to use it. I did what was written there and boom, now everything is working.

Now I think the web is only missing a clear guide on how to integrate zsh with Git.

@ale-diez

ale-diez commented Mar 8, 2022

Copy link
Copy Markdown

@fabriziocucci hey Fabrizio, happy to hear from you! I didn't think you would get back to this repo, honestly. I was used to Git Bash on windows, and this is the closest bash integration that I've found. Please let me know if I can help contributing to this repo; I'm sure @Ondkloss would be happy to do so too.

@fabriziocucci

fabriziocucci commented Mar 8, 2022

Copy link
Copy Markdown
Owner

@demedos happy to add you and @Ondkloss both as collaborators on the repo if you have bandwidth! 🙂

@Ondkloss

Ondkloss commented Mar 8, 2022

Copy link
Copy Markdown
Author

I think this PR is a bare minimum zsh support, but I think all of my fork would make sense at this point. I'll have to do a slight review though. But although bandwidth is limited I wouldn't mind the role as I do tend to respond to comments anyway.

@fabriziocucci

Copy link
Copy Markdown
Owner

Just sent an invite as collaborator to both of you @Ondkloss and @demedos.

@Ondkloss

Copy link
Copy Markdown
Author

Closing. Replaced by #17, which will probably have the same conclusion.

@Ondkloss Ondkloss closed this Mar 21, 2022
@THEWebDegenerate

THEWebDegenerate commented Mar 21, 2022 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants