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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

illeace created an issue. See original summary.

illeace’s picture

Status: Active » Needs review
FileSize
645 bytes

Here's the promised patch file.

nmillin’s picture

Needed 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.

Stacie_A’s picture

Great 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.

e0ipso’s picture

Status: Needs review » Closed (won't fix)

Version for D7 is unmaintained. I am sorry for the inconvenience.