mirror of
https://github.com/expo/fbshipit.git
synced 2026-11-15 17:33:57 -10:00
Summary:fixes #9 Depends on D3192600 Reviewed By: ebetica Differential Revision: D3192706 fb-gh-sync-id: dede691aad0a1e299e924c6cbf8deb6245013603 fbshipit-source-id: dede691aad0a1e299e924c6cbf8deb6245013603
42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?hh
|
|
/**
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
namespace Facebook\ShipIt;
|
|
|
|
final class SyncTrackingTest extends BaseTest {
|
|
public function testLastSourceCommit(): void {
|
|
$tempdir = new ShipItTempDir('git-sync-test');
|
|
$path = $tempdir->getPath();
|
|
|
|
// Prepare an empty repo
|
|
(new ShipItShellCommand($path, 'git', 'init'))->runSynchronously();
|
|
(new ShipItShellCommand(
|
|
$path,
|
|
'git', 'config', 'user.name', 'FBShipIt Unit Test',
|
|
))->runSynchronously();
|
|
(new ShipItShellCommand(
|
|
$path,
|
|
'git', 'config', 'user.email', '[email protected]',
|
|
))->runSynchronously();
|
|
|
|
// Add a tracked commit
|
|
$fake_commit_id = bin2hex(random_bytes(16));
|
|
$message = ShipItSync::addTrackingData(
|
|
(new ShipItChangeset())->withID($fake_commit_id)
|
|
)->getMessage();
|
|
(new ShipItShellCommand(
|
|
$path,
|
|
'git', 'commit', '--allow-empty', '-m', $message,
|
|
))->runSynchronously();
|
|
|
|
$repo = new ShipItRepoGIT($path, 'master');
|
|
$this->assertSame($fake_commit_id, $repo->findLastSourceCommit(ImmSet { }));
|
|
}
|
|
}
|