Bug 854061
Summary: | pollutes environment | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Enrico Scholz <rh-bugzilla> | ||||
Component: | git | Assignee: | Chris Wright <chrisw> | ||||
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | urgent | ||||||
Version: | rawhide | CC: | atkac, awilliam, bkearney, chrisw, lilyfan, tmz | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2012-11-22 15:52:16 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Enrico Scholz
2012-09-03 20:03:41 UTC
(In reply to comment #0) > * patch /etc/bash-completion.d/git so that git-prompt.sh is sourced. It > might violate the Fedora go-upstream strategy, but upstream does not install > git-prompt.sh in /etc/profile.d... In my opinion this is the best way. git-prompt.sh can be moved to /usr/share/git and sourced into bash-completion script. Additionally, we can patch git's bash-completion script to automatically set PS1 based on $ZSH_VERSION/$BASH_VERSION. However before I take an action, I would like to know opinion of other git maintainers, especially about setting the PS1 variable. While I disagree that the number of users of __git_ps1() is some small handful (it is quite likely larger than the number of people that care about keeping the output of set small), I'm fine with moving this just so we can stop having the pointless argument about "pollution" of the environment. I don't think we should be setting PS1 automatically at all. As far as location, what I would suggest is doing just what we do for the contributed hooks. They are installed in /usr/share/git-core/contrib/hooks. The contrib/completion from upstream can be copied here as well. If so, git-completion.bash can be symlinked to the bash-completion dir perhaps. (We wouldn't want folks filing bugs about wasting a few bytes of disk space.) We discussed putting all of the upstream contrib here and I think there's even an open bug on that somewhere still. I think that's a good idea, but to do so we'd need to carefully look at the scripts that are there and ensure that we don't pick up and unwanted requires or provides (or other rpmlint warnings/errors). As a git package with this broken packaging is going into f18 soon, this issue must be fixed asap. Else, people might start to rely on the polluted environment and a fix would introduce regressions. Created attachment 633399 [details]
Proposed patch
What do you think about this patch? It moves git-prompt.sh into datadir/git-core/contrib and then sources it into bash completion script.
Hi Adam, I think sourcing git-prompt.sh in the completion script is a bad idea. It defeats the reason that upstream split things out, doesn't it? I would also suggest putting the script in /usr/share/git-core/contrib/completion, because we're very likely to install more (or all) of contrib there as time permits and we don't want to have to move the git-prompt script again and break users that have set it up. Thanks for working on this. Sorry I've not had time to do anything with it lately. :/ (In reply to comment #5) > Hi Adam, > > I think sourcing git-prompt.sh in the completion script is a bad idea. It > defeats the reason that upstream split things out, doesn't it? > > I would also suggest putting the script in > /usr/share/git-core/contrib/completion, because we're very likely to install > more (or all) of contrib there as time permits and we don't want to have to > move the git-prompt script again and break users that have set it up. Agreed. I've just pushed a patch which installs git-prompt.sh into /usr/share/git-core/contrib/completion/ bash: __git_ps1: unknown command... jcharles@localhost ~/GIT/Lily$ Sorry to be so dumb, but how to activate it? I have in my .bashrc # affiche branche si dans un git export PS1="\u@\h \w\$(__git_ps1)$ " TIA, Jean-Charles Something like this: # affiche branche si dans un git source /usr/share/git-core/contrib/completion/git-prompt.sh export PS1="\u@\h \w\$(__git_ps1)$ " Check the path, I typed that from memory. It works like a charm. Your ROM is first class ! Thanks, Jean-Charles git-1.8.0-1.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/git-1.8.0-1.fc18 Package git-1.8.0-1.fc18: * should fix your issue, * was pushed to the Fedora 18 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing git-1.8.0-1.fc18' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2012-17708/git-1.8.0-1.fc18 then log in and leave karma (feedback). can we please stop screwing with the location after this? i'm tired of editing my bash profiles. :) (In reply to comment #12) > can we please stop screwing with the location after this? i'm tired of > editing my bash profiles. :) Sorry for that, now git-prompt.sh will be in /usr/share/git-core/contrib/completion for next decade :) I wouldn't count on it lasting that long: http://thread.gmane.org/gmane.comp.version-control.git/198249/focus=208359 That patch does leave a symlink in contrib/completion though, so as long as we're careful to ensure that we also install a symlink, nothing will break if/when upstream promotes the file that provides __git_ps1() out of contrib. This is already fixed in git-1.8.0-1.fc18 |