You are not logged in.

#1 2012-03-23 10:21:32

Edward E. Edwardson
Member
Registered: 2011-11-01
Posts: 36

[solved] bash-completion update broke completion for git

Hi!
Since the update of bash-completion (1.99-1) it doesn't work anymore for git (e.g. for completing branch names).

Any hints?

Last edited by Edward E. Edwardson (2012-03-23 10:38:12)

Offline

#2 2012-03-23 10:37:38

Edward E. Edwardson
Member
Registered: 2011-11-01
Posts: 36

Re: [solved] bash-completion update broke completion for git

I fixed it by replacing the following line in /etc/bash.bashrc

[ -r /etc/bash_completion ] && . /etc/bash_completion

with

[ -r /usr/share/bash-completion/bash_completion   ] && . /usr/share/bash-completion/bash_completion

Found it in /etc/bash.bashrc.pacnew.

Offline

#3 2012-03-27 22:51:46

cemsbr
Member
From: Brazil
Registered: 2008-05-03
Posts: 111
Website

Re: [solved] bash-completion update broke completion for git

It doesn't work for me:

$ . /usr/share/bash-completion/bash_completion
bash: __git_ps1: command not found
$ ls -l /usr/share/bash-completion/completions/git 
-rw-r--r-- 1 root root 56081 Mar 27 11:28 /usr/share/bash-completion/completions/git
bash: __git_ps1: command not found

Offline

#4 2012-03-28 03:49:13

ichramm
Member
Registered: 2011-08-03
Posts: 2

Re: [solved] bash-completion update broke completion for git

cemsbr wrote:

It doesn't work for me:

It happens the same to me, but it gets solved when I invoke bash_completion on git, I mean:

ichramm@notparallel:~$ 
bash: __git_ps1: command not found
ichramm@notparallel:~$ git <tab><tab>
add                 br                  ci                  config              filter-branch       help                lola                pull                replace             show                svn 
am                  bra                 cia                 credential-cache    format-patch        imap-send           ls                  push                request-pull        show-branch         tag 
annotate            branch              citool              credential-store    fsck                init                merge               rebase              reset               st                  whatchanged 
apply               bundle              clean               describe            gc                  instaweb            mergetool           reflog              revert              stage               
archive             checkout            clone               diff                get-tar-commit-id   lg                  mv                  relink              rm                  stash               
bisect              cherry              co                  difftool            grep                log                 name-rev            remote              send-email          status              
blame               cherry-pick         commit              fetch               gui                 lol                 notes               repack              shortlog            submodule           
ichramm@notparallel:~$ git ^C
ichramm@notparallel:~$ ^C
ichramm@notparallel:~$ 
ichramm@notparallel:~$ 

I couldn't figure out yet what the problem is

Offline

#5 2012-03-28 04:44:58

KerrickStaley
Member
Registered: 2011-01-26
Posts: 31

Re: [solved] bash-completion update broke completion for git

You can fix this by running

# ln -s /usr/share/git/completion/git-completion.bash /etc/bash_completion.d/git

as root (and then open a new shell).

Git's bash completion script doesn't just load the completions: it also defines __git_ps1 and a few other things.

git-1.7.9.4-1 installs /etc/bash_completion.d/git (which gets loaded every time you run a shell), but in git-1.7.9.5-1 it instead installs /usr/share/bash-completion/completions/git/ (which apparently gets loaded on-the-fly when you try to complete a git command).

I'm not sure if this is an intentional change or a mistake. I filed a bug at https://bugs.archlinux.org/task/29141, but maybe this is just an additional step people will now need to do if they want to use __git_ps1.

Offline

#6 2012-04-03 02:19:00

tsyijiu
Member
Registered: 2012-03-19
Posts: 6

Re: [solved] bash-completion update broke completion for git

Why I encountered like this after I update bash-completion to 1.99-2

bash: _compopt_o_filenames: command not found

Offline

#7 2017-04-24 01:50:07

Troupal
Member
Registered: 2017-04-24
Posts: 1

Re: [solved] bash-completion update broke completion for git

I fixed it with zsh, by adding this line into /etc/profile:

 [ -r /usr/share/bash-completion/bash_completion   ] && . /usr/share/bash-completion/bash_completion

here:

 # Source global bash config
if test "$PS1" && test "$BASH" && test -z ${POSIXLY_CORRECT+x} && test -r /etc/bash.bashrc; then
        . /etc/bash.bashrc
fi

[-r /usr/share/bash-completion/bash_completion ] && ./usr/share/bash-completion/bash_completion

Offline

#8 2017-04-24 02:05:12

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [solved] bash-completion update broke completion for git

The thread is five years old and marked as solved. Don't necrobump: https://wiki.archlinux.org/index.php/Co … bumping.22



Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB