mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Fix fatal in Git hook when a --force push completely rewrites a ref
Summary: Fixes T4224. If you `git merge-base A B`, and they have //no// ancestor, the command exits with an error. Assume errors mean "no ancestry" and continue. Test Plan: Completely rewrite a repository with a `--force` push. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4224 Differential Revision: https://secure.phabricator.com/D7756
This commit is contained in:
parent
6b1ec35cf3
commit
61c934449d
1 changed files with 13 additions and 2 deletions
|
@ -256,8 +256,19 @@ final class DiffusionCommitHookEngine extends Phobject {
|
|||
}
|
||||
|
||||
foreach (Futures($futures)->limit(8) as $key => $future) {
|
||||
list($stdout) = $future->resolvex();
|
||||
$updates[$key]['merge-base'] = rtrim($stdout, "\n");
|
||||
|
||||
// If 'old' and 'new' have no common ancestors (for example, a force push
|
||||
// which completely rewrites a ref), `git merge-base` will exit with
|
||||
// an error and no output. It would be nice to find a positive test
|
||||
// for this instead, but I couldn't immediately come up with one. See
|
||||
// T4224. Assume this means there are no ancestors.
|
||||
|
||||
list($err, $stdout) = $future->resolve();
|
||||
if ($err) {
|
||||
$updates[$key]['merge-base'] = null;
|
||||
} else {
|
||||
$updates[$key]['merge-base'] = rtrim($stdout, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
return $updates;
|
||||
|
|
Loading…
Reference in a new issue