/** * Writes the current Git commit ID to the remote site. * * @param \Ftp $ftp An active FTP connection. */ protected function writeGitCommit(\Ftp $ftp) { $ftp->chdir($this->targetDirectory); // get the current commit hash $result = (new ExecTask('git'))->arg('rev-parse')->arg('HEAD')->run(); // write the commit hash to the meta file $stream = fopen('data://text/plain,' . trim($result->getMessage()), 'r'); $ftp->fput('.git-commit', $stream, FTP_ASCII); }