1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Fix existence test in "reconcile.php"

Summary:
"rev-parse --verify" is actually a terrible test, it only survived my test cases
because I put garbage into the tables with RAND() or similar, not
properly-formatted garbage.

Use "cat-file -t" instead to ensure we perform an object-existence test.

Test Plan: Ran "reconcile.php P" locally, ran "cat-file -t" and "rev-parse
--verify" on properly-formatted but invalid hashes like
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", worked with @rguerin to resolve
commit issues.

Reviewers: btrahan, rguerin

Reviewed By: rguerin

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1590
This commit is contained in:
epriestley 2012-02-07 10:46:26 -08:00
parent 47631530a5
commit f19d5fbeae

View file

@ -88,8 +88,11 @@ try {
echo "Verifying commits (this may take some time if the repository is large)";
$futures = array();
foreach ($all_commits as $id => $commit) {
// NOTE: We use "cat-file -t", not "rev-parse --verify", because
// "rev-parse --verify" does not verify that the object actually exists, only
// that the name is properly formatted.
$futures[$id] = $repository->getLocalCommandFuture(
'rev-parse --verify %s',
'cat-file -t %s',
$commit->getCommitIdentifier());
}