From f19d5fbeae67574f82e4745199d3513114cd9d2e Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 7 Feb 2012 10:46:26 -0800 Subject: [PATCH] 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 --- scripts/repository/reconcile.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/repository/reconcile.php b/scripts/repository/reconcile.php index 6e45f034a2..224438c21b 100755 --- a/scripts/repository/reconcile.php +++ b/scripts/repository/reconcile.php @@ -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()); }