Skip to content

Commit f19d5fb

Browse files
author
epriestley
committed
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
1 parent 4763153 commit f19d5fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/repository/reconcile.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@
8888
echo "Verifying commits (this may take some time if the repository is large)";
8989
$futures = array();
9090
foreach ($all_commits as $id => $commit) {
91+
// NOTE: We use "cat-file -t", not "rev-parse --verify", because
92+
// "rev-parse --verify" does not verify that the object actually exists, only
93+
// that the name is properly formatted.
9194
$futures[$id] = $repository->getLocalCommandFuture(
92-
'rev-parse --verify %s',
95+
'cat-file -t %s',
9396
$commit->getCommitIdentifier());
9497
}
9598

0 commit comments

Comments
 (0)