On a Mac, using Acquia DevDesktop (and presumably MAMP or other option), the environment indicator module does not display the git branch name in the toolbar.
Digging through the issue a bit, I see the problem is in environment_indicator_execute_os_command(), which uses the proc_open() PHP function. There seems to be a difference in the behavior of PHP and proc_open() on different operating systems. On the Linux machines I've tested, the default current working directory (the one where the "git describe --all" command is executed) is the site's public root. On my Mac, the default current working directory is the PHP binary location (my Acquia Dev Desktop application directory). As a result, running "git describe --all" errors out because the Acquia Dev Desktop application directory is not a git repository. When I print out $stderr, I see the message "fatal: Not a git repository (or any of the parent directories): .git".
Apparently this difference is peculiar to proc_open(), as other methods of running system commands behave the same. See https://bugs.php.net/bug.php?id=50524.
Luckily proc_open() allows for an optional parameter to set the working directory. I suggest environment_indicator_execute_os_command() use this parameter to explicitly set the site's public root as the working directory for the command. Patch file incoming soon.
Comment | File | Size | Author |
---|---|---|---|
#3 | git-branch-fails-on-mac-2853649-3.patch | 409 bytes | nmillin |
#2 | git-branch-fails-on-mac-2853649-2.patch | 645 bytes | illeace |
Comments
Comment #2
illeace CreditAttribution: illeace at Clarity Innovations, Inc. commentedHere's the promised patch file.
Comment #3
nmillin CreditAttribution: nmillin commentedNeeded to manually apply patch, but it worked for me. The branch is now being picked up. I've uploaded a new patch (same code), but /web/public/sites/all/modules/contrib/environment_indicator is stripped out so it will apply cleanly.
Comment #4
Stacie_A CreditAttribution: Stacie_A commentedGreat patch #3! It's nice to see my git branch on local again.
I did find that I needed to make sure to agree to the latest Xcode license agreement to make it work.
I did it from command line as the error prompted.
sudo xcodebuild -license
But i'm pretty sure that opening Xcode and agreeing to the license via the popup gui would have also settled this.
Comment #5
e0ipsoVersion for D7 is unmaintained. I am sorry for the inconvenience.