[MacPorts] #37117: git-core 1.8.0 bash completions missing git-prompt.sh code
#37117: git-core 1.8.0 bash completions missing git-prompt.sh code --------------------+-------------------------------- Reporter: jeff@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Keywords: | Port: --------------------+-------------------------------- __git_ps1 is no longer a defined function in the bash completions, breaking some code I use to put the branch name in my prompt. It seems that this function is in git-prompt.sh which is a second file from Shawn O. Pearce's bash completion code that the +bash_completion variant does not include. -- Ticket URL: <https://trac.macports.org/ticket/37117> MacPorts <http://www.macports.org/> Ports system for Mac OS
#37117: git-core 1.8.0 bash completions missing git-prompt.sh code ---------------------+-------------------------------- Reporter: jeff@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: | ---------------------+-------------------------------- Comment (by jeff@…): This is the git-prompt.sh file in question: https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh -- Ticket URL: <https://trac.macports.org/ticket/37117#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#37117: git-core 1.8.0 bash completions missing git-prompt.sh code -----------------------+------------------------- Reporter: jeff@… | Owner: ciserlohn@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: git-core | -----------------------+------------------------- Changes (by ryandesign@…): * owner: macports-tickets@… => ciserlohn@… * port: => git-core Old description:
__git_ps1 is no longer a defined function in the bash completions, breaking some code I use to put the branch name in my prompt. It seems that this function is in git-prompt.sh which is a second file from Shawn O. Pearce's bash completion code that the +bash_completion variant does not include.
New description: `__git_ps1` is no longer a defined function in the bash completions, breaking some code I use to put the branch name in my prompt. It seems that this function is in git-prompt.sh which is a second file from Shawn O. Pearce's bash completion code that the +bash_completion variant does not include. -- -- Ticket URL: <https://trac.macports.org/ticket/37117#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#37117: git-core 1.8.0 bash completions missing git-prompt.sh code -----------------------+------------------------- Reporter: jeff@… | Owner: ciserlohn@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: invalid | Keywords: Port: git-core | -----------------------+------------------------- Changes (by ciserlohn@…): * status: new => closed * resolution: => invalid Comment: The git-core port always installs git-prompt.sh. It located in ${prefix}/share/git-core/ (use 'port contents git-core' to find it on your system). You will have to add something like this to your ~/.bashrc or ~/.profile to use it: {{{ if [ -f /opt/local/share/git-core/git-prompt.sh ]; then . /opt/local/share/git-core/git-prompt.sh fi }}} -- Ticket URL: <https://trac.macports.org/ticket/37117#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#37117: git-core 1.8.0 bash completions missing git-prompt.sh code -----------------------+------------------------- Reporter: jeff@… | Owner: ciserlohn@… Type: defect | Status: reopened Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: git-core | -----------------------+------------------------- Changes (by jeff@…): * status: closed => reopened * resolution: invalid => Comment: But the proper place is for it to be added to the /opt/local/etc/bash_completion.d directory so that if [ -f /opt/local/etc/bash_completion ]; then . /opt/local/etc/bash_completion fi works as expected and has previously. Reopening. -- Ticket URL: <https://trac.macports.org/ticket/37117#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#37117: git-core 1.8.0 bash completions missing git-prompt.sh code -----------------------+------------------------- Reporter: jeff@… | Owner: ciserlohn@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: invalid | Keywords: Port: git-core | -----------------------+------------------------- Changes (by ciserlohn@…): * status: reopened => closed * resolution: => invalid Comment: Replying to [comment:4 jeff@…]:
But the proper place is for it to be added to the /opt/local/etc/bash_completion.d directory so that
It's not the proper place (by the way /opt/local/etc/bash_completion.d is legacy, the new diretory is /opt/local/share/bash- completion/completions/). The git_prompt.sh has been split out because (see https://github.com/git/git/commit/af31a456b4cd38f2630ed8e556e23954f806a3cc): * bash_completion can load completions dynamically, which means that the git_ps1() function is not available when the shell is created * some users are only interested in the !__git_ps1() function but not the completions (e.g. zsh users), others are only interested in the completions not the !__git_ps1() function (e.g. users who have tweaked their prompt in other ways) Therefor is better to have both scripts in separate places where they can be individually sourced. -- Ticket URL: <https://trac.macports.org/ticket/37117#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
#37117: git-core 1.8.0 bash completions missing git-prompt.sh code -----------------------+------------------------- Reporter: jeff@… | Owner: ciserlohn@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: invalid | Keywords: Port: git-core | -----------------------+------------------------- Comment (by jeff@…): And how do I do completion of my aliases? I have "gch" as `git checkout` and code that previously worked to make gch have bash completion just like git checkout. But now, I get "completion: function `_git_checkout' not found" when I hit tab. -- Ticket URL: <https://trac.macports.org/ticket/37117#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts