When calling a checkout task with a branch as parameter I get a fatal: no tag exactly matches '0b0f0fsomegithash5f68a8527ed' line printed to std out. The task has a success status, and the branch is checked out as expected... just the output is bad.

It seems to be coming from drush/provision_git.drush.inc:

   if (drush_shell_cd_and_exec($repo_path, 'git describe --tags --exact-match || git symbolic-ref -q HEAD')) {
      $temp_git_ref = str_replace('refs/heads/', '',drush_shell_exec_output());
      $git_ref = (!empty($temp_git_ref) && is_string($temp_git_ref)) ? trim($temp_git_ref) : $temp_git_ref;
      drush_set_option('git_ref', $git_ref);
    }

Would the new Process code be a solution here?

Comments

helmo created an issue.

jon pugh’s picture

The only way to prevent that message is to pipe it to null.

This is what I do in devshop:

    $environment->git_ref = trim(str_replace('refs/heads/', '', shell_exec("cd {$environment->repo_path}; git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q HEAD 2> /dev/null")));

I might want to adopt a PHP/Git library like TQGit/Repository for this instead. I have a few of these "git describe" calls in the codebase, I would much rather have a method.