pedroborges / kirby-autogit

⬢ Saves every change made via Kirby Panel to a Git repository
149 stars 23 forks source link

Single quotes causing issues with git commands #11

Closed Rainbowlemon closed 7 years ago

Rainbowlemon commented 7 years ago

Hey,

I've been having trouble setting this plugin up, and I've narrowed it down to the usage of single quotes in autogit.php. PHP's exec doesn't like the single quotes and throws an error when it tries to perform anything. Changing all quotes in strings to double quotes fixed the issue for me.

pedroborges commented 7 years ago

Sorry, I can't replicate this. Examples on the PHP docs also use single quote. Which version of PHP do you have?

Rainbowlemon commented 7 years ago

My apologies, this ticket could have been named better. I was in a rush when I wrote it!

Basically, by changing the execute lines from double quotes with parsed variables, to single quotes with concatenated strings, it fixed an issue I was having with Git being unable to execute. As with my previous comment on this repo, I think this was because the Git version on the remote server was out of date and I didn't have access to update it. Eg as follows:

public function pull()
    {
        $this->execute("pull {$this->remoteName} {$this->remoteBranch} 2>&1");
    }

Changed to:

$this->execute('pull ' . $this->remoteName . ' ' . $this->remoteBranch . ' 2>&1');