From e0a56cb9381e6cfae6f01a679c530745ddf50f6f Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 17 Nov 2011 11:44:28 -0800 Subject: [PATCH] Clean up two more sha1 instances Summary: See T547. One of these I just missed in D1000; the comment change just makes it easier to audit use of hash functions by cleaning up "grep" output. Test Plan: Ran isolation unit test. Reviewers: btrahan, jungejason, nh, tuomaspelkonen, aran Reviewed By: jungejason CC: aran, jungejason Differential Revision: 1124 --- src/applications/diffusion/request/git/DiffusionGitRequest.php | 2 +- .../__tests__/AphrontIsolatedDatabaseConnectionTestCase.php | 2 +- src/storage/connection/isolated/__tests__/__init__.php | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/applications/diffusion/request/git/DiffusionGitRequest.php b/src/applications/diffusion/request/git/DiffusionGitRequest.php index 82b244ea38..2232cb1996 100644 --- a/src/applications/diffusion/request/git/DiffusionGitRequest.php +++ b/src/applications/diffusion/request/git/DiffusionGitRequest.php @@ -62,7 +62,7 @@ class DiffusionGitRequest extends DiffusionRequest { $this->commit); // Beyond verifying them, expand commit short forms to full 40-character - // sha1s. + // hashes. $this->commit = trim($commit); // If we have a commit, overwrite the branch commit with the more diff --git a/src/storage/connection/isolated/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php b/src/storage/connection/isolated/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php index dbed341c2f..e92aef2150 100644 --- a/src/storage/connection/isolated/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php +++ b/src/storage/connection/isolated/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php @@ -31,7 +31,7 @@ class AphrontIsolatedDatabaseConnectionTestCase public function testIsolation() { $conn = $this->newIsolatedConnection(); - $test_phid = 'PHID-TEST-'.sha1(mt_rand()); + $test_phid = 'PHID-TEST-'.Filesystem::readRandomCharacters(20); queryfx( $conn, diff --git a/src/storage/connection/isolated/__tests__/__init__.php b/src/storage/connection/isolated/__tests__/__init__.php index ce36833299..01b64ad096 100644 --- a/src/storage/connection/isolated/__tests__/__init__.php +++ b/src/storage/connection/isolated/__tests__/__init__.php @@ -11,6 +11,7 @@ phutil_require_module('phabricator', 'infrastructure/testing/testcase'); phutil_require_module('phabricator', 'storage/connection/isolated'); phutil_require_module('phabricator', 'storage/queryfx'); +phutil_require_module('phutil', 'filesystem'); phutil_require_module('phutil', 'utils');