# bug in bash completion for git-branch --set-upstream-to on OSX

2 messages from 2015-03-20 to 2015-03-22. Participants: Jason Karns, Eric Sunshine.
Thread: https://gitlist.dev/t/38868

## Jason Karns, 2015-03-20 15:15

Subject: bug in bash completion for git-branch --set-upstream-to on OSX
Message-ID: <CAKNmmv3wu-5s9UB_RFO5Wptdo+a71Lmzn2Zs4kb=MwnFoTctCg@mail.gmail.com>
URL: https://gitlist.dev/e/CAKNmmv3wu-5s9UB_RFO5Wptdo%2Ba71Lmzn2Zs4kb%3DMwnFoTctCg%40mail.gmail.com

```
There appears to be a bug in the bash completion for git-branch when
attempting to complete the remote ref argument for --set-upstream-to=

When:

$ git branch --set-upstream-to=origin/mast<TAB>

I would expect it to complete to:

$ git branch --set-upstream-to=origin/master

However, the completion for --set-upstream-to= completes the ref
correctly, but completely wipes the --set-upstream option; resulting
in:

$ git branch origin/master


I'm running on OS X 10.9.5 with git from homebrew:
$ bash --version
GNU bash, version 4.3.33(1)-release (x86_64-apple-darwin13.4.0)
$ git --version
git version 2.3.3

The same behavior does *not* manifest (it works as expected) on CentOS
6.5, bash 4.1.2.1 (GNU bash, version 4.1.2(1)-release
(x86_64-redhat-linux-gnu)). I'm running git 2.0.3 on CentOs but
sourcing the shell completion script from latest source: 9ab698f

I also cloned down latest git source on OS X and the bug still
manifests when sourcing the completion script at 9ab698f.

~ Jason

```

## Eric Sunshine, 2015-03-22 03:24

Subject: Re: bug in bash completion for git-branch --set-upstream-to on OSX
Message-ID: <CAPig+cRYQfSNvyCXJc2a4wFAsZ8S4v3zvc5K5-fW+guepMeVPg@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcRYQfSNvyCXJc2a4wFAsZ8S4v3zvc5K5-fW%2BguepMeVPg%40mail.gmail.com
In-Reply-To: <CAKNmmv3wu-5s9UB_RFO5Wptdo+a71Lmzn2Zs4kb=MwnFoTctCg@mail.gmail.com>

```
On Fri, Mar 20, 2015 at 11:15 AM, Jason Karns <karns.17@gmail.com> wrote:
> There appears to be a bug in the bash completion for git-branch when
> attempting to complete the remote ref argument for --set-upstream-to=
>
> When:
>
> $ git branch --set-upstream-to=origin/mast<TAB>
>
> I would expect it to complete to:
>
> $ git branch --set-upstream-to=origin/master
>
> However, the completion for --set-upstream-to= completes the ref
> correctly, but completely wipes the --set-upstream option; resulting
> in:
>
> $ git branch origin/master
>
> I'm running on OS X 10.9.5 with git from homebrew:
> $ bash --version
> GNU bash, version 4.3.33(1)-release (x86_64-apple-darwin13.4.0)

Presumably, your bash is also from homebrew? Stock OS X bash tends to
be quite a bit older.

> $ git --version
> git version 2.3.3

I'm unable to reproduce this problem using git 2.3.3 and bash 4.3.33.

> The same behavior does *not* manifest (it works as expected) on CentOS
> 6.5, bash 4.1.2.1 (GNU bash, version 4.1.2(1)-release
> (x86_64-redhat-linux-gnu)). I'm running git 2.0.3 on CentOs but
> sourcing the shell completion script from latest source: 9ab698f
>
> I also cloned down latest git source on OS X and the bug still
> manifests when sourcing the completion script at 9ab698f.

Perhaps something in your bash startup script(s) is causing a strange
interaction.

```
