4 ms·
What do you mean by “git often installs”. Git does not install anything. Developers configure their PS1 or install something that does.
by isatty 5y ago
What do you mean by “git often installs”. Git does not install anything. Developers configure their PS1 or install something that does.
- gruez 5y agoon windows the default git package (ie. git bash) installs a bash terminal that has the git PS1 enabled.
- edgyquant 5y agoThe default shell on Mac and a lot of Linux distros do this installation, as well as git for windows.
- asvitkine 5y agoCan you explain? A shell isn't supposed to be installing things on it's own... (Assuming you're talking about zsh or bash when you say shell.)
- loa_in_ 5y agoYeah, even zsh doesn't do this by default
- jyrkesh 5y agoThere's a lot of different ways to install Git on a lot of different OSes, and some of them put helper shell scripts down by default.
- Sharparam 5y agoThat isn't Git installing things though, that is third-party Git distributions bundling things along with Git.
- jyrkesh 5y agoI'm aware, which is why I phrased it like I did. A lot of folks don't know or understand the distinction when they're installing Git (or installing something else that happens to bring Git with it). The overarching point is that the shell itself is not installing anything at shell runtime. E.g. it's the Git Bash installer, not opening `bash`.
- ratcline 5y agoIt's not doing it on it's own, I believe what they're referring to is a a pre-configured distribution of a shell packaged with some distributions of Git, for some OSes.
- everybodyknows 5y agoCan you say what Linux distro does this? Seems like very poor taste for a command shell to be assuming one particular SCM.
- dotancohen 5y agoCommand shells assume a lot of things, such as your preferred text editor, locale, input and output devices, etc. Most of these things can be configured, but the default install makes assumptions based on common configurations.
- berkes 5y agoOn Ubuntu, and I presume therefore many debian derivatives and debian itself, `apt get git` will install a file called `/usr/lib/git-core/git-sh-prompt` (dpkg -S /usr/lib/git-core/git-sh-prompt). This script allows you to see repository status in your prompt. It comes with 5 utility functions that AFAIKS are usable in all common shells: __git_ps1_show_upstream () __git_ps1_colorize_gitstring () __git_eread () __git_sequencer_status () __git_ps1 () On Ubuntu those aren't installed into bash by default, but you need to add it yourself to your ~/.bashrc (or zsh or whatever, but those aren't the default in Ubuntu). The mechanisms aren't in place for a package to inject itself into your prompt, but it isn't unthinkable (though maybe unwanted) to have that. Similar to how tab-complete for bash is handled: The `git` package installs a file `/usr/share/bash-completion/completions/git` which is picked up by bash, on Ubuntu, as a pluggable way to extend autocomplete on bash. Many packages do this, on my machine there's 960 files in there (ls -1 /usr/share/bash-completion/completions/ | wc -l).¹ It would be trivial to have a similar mechanism for `bash_rc.d` which allows for a pluggable system to extend and modify your bash. Again, I presume this to be unwanted. I would oppose it. ¹ This is why I was surprised to learn that people like zsh for the reason that it offers tab-completion: I always presumed bash did that out of the box for any installed package already. Turns out it is Ubuntu (or better: Debian) doing this for me.
- leni536 5y agoThis feels like tab completion is a more serious attack vector then?
- chrisseaton 5y ago> Git does not install anything. It's literally a Git installer.