diff --git a/dev/conductor/lib/next.dart b/dev/conductor/lib/next.dart index ea9fb52778..2379ff818b 100644 --- a/dev/conductor/lib/next.dart +++ b/dev/conductor/lib/next.dart @@ -105,8 +105,6 @@ void runNext({ upstreamRemote: upstream, previousCheckoutLocation: state.engine.checkoutPath, ); - final String headRevision = engine.reverseParse('HEAD'); - // check if the candidate branch is enabled in .ci.yaml if (!engine.ciYaml.enabledBranches.contains(state.engine.candidateBranch)) { engine.ciYaml.enableBranch(state.engine.candidateBranch); @@ -157,7 +155,7 @@ void runNext({ } engine.pushRef( - fromRef: headRevision, + fromRef: 'HEAD', // Explicitly create new branch toRef: 'refs/heads/${state.engine.workingBranch}', remote: state.engine.mirror.name, @@ -221,7 +219,6 @@ void runNext({ upstreamRemote: upstream, previousCheckoutLocation: state.framework.checkoutPath, ); - final String headRevision = framework.reverseParse('HEAD'); // Check if the current candidate branch is enabled if (!framework.ciYaml.enabledBranches.contains(state.framework.candidateBranch)) { @@ -290,7 +287,7 @@ void runNext({ } framework.pushRef( - fromRef: headRevision, + fromRef: 'HEAD', // Explicitly create new branch toRef: 'refs/heads/${state.framework.workingBranch}', remote: state.framework.mirror.name, diff --git a/dev/conductor/test/next_test.dart b/dev/conductor/test/next_test.dart index ef73409d39..2c2eede3ee 100644 --- a/dev/conductor/test/next_test.dart +++ b/dev/conductor/test/next_test.dart @@ -84,10 +84,6 @@ void main() { const FakeCommand( command: ['git', 'checkout', workingBranch], ), - const FakeCommand( - command: ['git', 'rev-parse', 'HEAD'], - stdout: revision1, - ), ]); final FakePlatform platform = FakePlatform( environment: { @@ -149,10 +145,6 @@ void main() { final FakeProcessManager processManager = FakeProcessManager.list([ const FakeCommand(command: ['git', 'fetch', 'upstream']), const FakeCommand(command: ['git', 'checkout', workingBranch]), - const FakeCommand( - command: ['git', 'rev-parse', 'HEAD'], - stdout: revision1, - ), const FakeCommand( command: ['git', 'status', '--porcelain'], stdout: 'MM blah', @@ -233,10 +225,6 @@ void main() { _initializeCiYamlFile(file); }, ), - const FakeCommand( - command: ['git', 'rev-parse', 'HEAD'], - stdout: revision1, - ), const FakeCommand( command: ['git', 'status', '--porcelain'], stdout: 'MM .ci.yaml', @@ -247,7 +235,7 @@ void main() { command: ['git', 'rev-parse', 'HEAD'], stdout: revision2, ), - const FakeCommand(command: ['git', 'push', 'mirror', '$revision1:refs/heads/$workingBranch']), + const FakeCommand(command: ['git', 'push', 'mirror', 'HEAD:refs/heads/$workingBranch']), ]); final FakePlatform platform = FakePlatform( environment: { @@ -533,10 +521,6 @@ void main() { _initializeCiYamlFile(file); }, ), - const FakeCommand( - command: ['git', 'rev-parse', 'HEAD'], - stdout: revision2, - ), const FakeCommand( command: ['git', 'status', '--porcelain'], stdout: 'MM /path/to/.ci.yaml', @@ -627,10 +611,6 @@ void main() { ), const FakeCommand(command: ['git', 'fetch', 'upstream']), const FakeCommand(command: ['git', 'checkout', workingBranch]), - const FakeCommand( - command: ['git', 'rev-parse', 'HEAD'], - stdout: revision2, - ), const FakeCommand( command: ['git', 'status', '--porcelain'], stdout: 'MM path/to/.ci.yaml', @@ -709,10 +689,6 @@ void main() { _initializeCiYamlFile(file); }, ), - const FakeCommand( - command: ['git', 'rev-parse', 'HEAD'], - stdout: revision2, - ), const FakeCommand( command: ['git', 'status', '--porcelain'], stdout: 'MM path/to/.ci.yaml', @@ -742,7 +718,7 @@ void main() { stdout: revision4, ), const FakeCommand( - command: ['git', 'push', 'mirror', '$revision2:refs/heads/$workingBranch'], + command: ['git', 'push', 'mirror', 'HEAD:refs/heads/$workingBranch'], ), ]); writeStateToFile( @@ -783,7 +759,7 @@ void main() { ); expect( stdio.stdout, - contains('Executed command: `git push mirror $revision2:refs/heads/$workingBranch`'), + contains('Executed command: `git push mirror HEAD:refs/heads/$workingBranch`'), ); expect(stdio.error, isEmpty); });