Subject: Strange behavior (possible bug) using bash command subsitution with "git branch"

From: Kate Ebneter <[email-masked]>
Date: Sun, 08 Nov 2009 14:11:56 -0800

Hi, folks,

I ran into a weird situation while working on a script, which is best
described with a little snippet from my gitosis-admin repository:

    $ git branch
    * master
    $ branch=$(git branch)
    $ echo $branch
    gitosis.conf keydir master

That is, if you run 'git branch' inside $() or ``, it lists the directories,
too. I can't imagine that this is intended behavior, but perhaps I'm wrong.

I can reproduce this on CentOS, Ubuntu, Solaris, and Mac OS X using git
1.6.2.3, 1.6.3.2, 1.6.3.3, 1.6.4.2, and 1.6.5.2.

(In the end, I figured out a better way to write my script anyway, but this
is just too weird not to ask about.)

Thanks,
Kate Ebneter
Somewhat befuddled build engineer