[flutter_conductor] fix initialref to explicitly include remote name (#96481)

diff --git a/dev/conductor/core/lib/src/next.dart b/dev/conductor/core/lib/src/next.dart
index 575ce03..258706c 100644
--- a/dev/conductor/core/lib/src/next.dart
+++ b/dev/conductor/core/lib/src/next.dart
@@ -101,22 +101,6 @@
             upstreamRemote: upstream,
             previousCheckoutLocation: state.engine.checkoutPath,
         );
-        // check if the candidate branch is enabled in .ci.yaml
-        final CiYaml engineCiYaml = await engine.ciYaml;
-        if (!engineCiYaml.enabledBranches.contains(state.engine.candidateBranch)) {
-          engineCiYaml.enableBranch(state.engine.candidateBranch);
-          // commit
-          final String revision = await engine.commit(
-              'add branch ${state.engine.candidateBranch} to enabled_branches in .ci.yaml',
-              addFirst: true,
-          );
-          // append to list of cherrypicks so we know a PR is required
-          state.engine.cherrypicks.add(pb.Cherrypick(
-                  appliedRevision: revision,
-                  state: pb.CherrypickState.COMPLETED,
-          ));
-        }
-
         if (!state_import.requiresEnginePR(state)) {
           stdio.printStatus(
               'This release has no engine cherrypicks. No Engine PR is necessary.\n',
@@ -213,21 +197,6 @@
           previousCheckoutLocation: state.framework.checkoutPath,
         );
 
-        // Check if the current candidate branch is enabled
-        if (!(await framework.ciYaml).enabledBranches.contains(state.framework.candidateBranch)) {
-          (await framework.ciYaml).enableBranch(state.framework.candidateBranch);
-          // commit
-          final String revision = await framework.commit(
-              'add branch ${state.framework.candidateBranch} to enabled_branches in .ci.yaml',
-              addFirst: true,
-          );
-          // append to list of cherrypicks so we know a PR is required
-          state.framework.cherrypicks.add(pb.Cherrypick(
-                  appliedRevision: revision,
-                  state: pb.CherrypickState.COMPLETED,
-          ));
-        }
-
         stdio.printStatus('Rolling new engine hash $engineRevision to framework checkout...');
         final bool needsCommit = await framework.updateEngineRevision(engineRevision);
         if (needsCommit) {
diff --git a/dev/conductor/core/lib/src/repository.dart b/dev/conductor/core/lib/src/repository.dart
index 36e4440..f33dc47 100644
--- a/dev/conductor/core/lib/src/repository.dart
+++ b/dev/conductor/core/lib/src/repository.dart
@@ -844,46 +844,4 @@
   /// This is not cached as the contents can be written to while the conductor
   /// is running.
   YamlMap get contents => loadYaml(stringContents) as YamlMap;
-
-  List<String> get enabledBranches {
-    final YamlList yamlList = contents['enabled_branches'] as YamlList;
-    return yamlList.map<String>((dynamic element) {
-      return element as String;
-    }).toList();
-  }
-
-  static final RegExp _enabledBranchPattern = RegExp(r'enabled_branches:');
-
-  /// Update this .ci.yaml file with the given branch name.
-  ///
-  /// The underlying [File] is written to, but not committed to git. This method
-  /// will throw a [ConductorException] if the [branchName] is already present
-  /// in the file or if the file does not have an "enabled_branches:" field.
-  void enableBranch(String branchName) {
-    final List<String> newStrings = <String>[];
-    if (enabledBranches.contains(branchName)) {
-      throw ConductorException('${file.path} already contains the branch $branchName');
-    }
-    if (!_enabledBranchPattern.hasMatch(stringContents)) {
-      throw ConductorException(
-        'Did not find the expected string "enabled_branches:" in the file ${file.path}',
-      );
-    }
-    final List<String> lines = stringContents.split('\n');
-    bool insertedCurrentBranch = false;
-    for (final String line in lines) {
-      // Every existing line should be copied to the new Yaml
-      newStrings.add(line);
-      if (insertedCurrentBranch) {
-        continue;
-      }
-      if (_enabledBranchPattern.hasMatch(line)) {
-        insertedCurrentBranch = true;
-        // Indent two spaces
-        final String indent = ' ' * 2;
-        newStrings.add('$indent- ${branchName.trim()}');
-      }
-    }
-    file.writeAsStringSync(newStrings.join('\n'), flush: true);
-  }
 }
diff --git a/dev/conductor/core/lib/src/start.dart b/dev/conductor/core/lib/src/start.dart
index 3227396..f4865f2 100644
--- a/dev/conductor/core/lib/src/start.dart
+++ b/dev/conductor/core/lib/src/start.dart
@@ -235,7 +235,7 @@
   }) : git = Git(processManager),
   engine = EngineRepository(
     checkouts,
-    initialRef: candidateBranch,
+    initialRef: 'upstream/$candidateBranch',
     upstreamRemote: Remote(
       name: RemoteName.upstream,
       url: engineUpstream,
@@ -246,7 +246,7 @@
     ),
   ), framework = FrameworkRepository(
     checkouts,
-    initialRef: candidateBranch,
+    initialRef: 'upstream/$candidateBranch',
     upstreamRemote: Remote(
       name: RemoteName.upstream,
       url: frameworkUpstream,
diff --git a/dev/conductor/core/test/next_test.dart b/dev/conductor/core/test/next_test.dart
index edfb98c..b3aac64 100644
--- a/dev/conductor/core/test/next_test.dart
+++ b/dev/conductor/core/test/next_test.dart
@@ -25,7 +25,6 @@
   const String remoteUrl = 'https://github.com/org/repo.git';
   const String revision1 = 'd3af60d18e01fcb36e0c0fa06c8502e4935ed095';
   const String revision2 = 'f99555c1e1392bf2a8135056b9446680c2af4ddf';
-  const String revision3 = '98a5ca242b9d270ce000b26309b8a3cdc9c89df5';
   const String revision4 = '280e23318a0d8341415c66aa32581352a421d974';
   const String releaseVersion = '1.2.0-3.0.pre';
   const String releaseChannel = 'beta';
@@ -82,12 +81,7 @@
 
     group('APPLY_ENGINE_CHERRYPICKS to CODESIGN_ENGINE_BINARIES', () {
       test('does not prompt user and updates currentPhase if there are no engine cherrypicks', () async {
-        final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
-          const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
-          const FakeCommand(
-            command: <String>['git', 'checkout', workingBranch],
-          ),
-        ]);
+        final FakeProcessManager processManager = FakeProcessManager.empty();
         final FakePlatform platform = FakePlatform(
           environment: <String, String>{
             'HOME': <String>['path', 'to', 'home'].join(localPathSeparator),
@@ -145,24 +139,7 @@
         final File ciYaml = fileSystem.file('$checkoutsParentDirectory/engine/.ci.yaml')
             ..createSync(recursive: true);
         _initializeCiYamlFile(ciYaml);
-        final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
-          const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
-          const FakeCommand(command: <String>['git', 'checkout', workingBranch]),
-          const FakeCommand(
-            command: <String>['git', 'status', '--porcelain'],
-            stdout: 'MM blah',
-          ),
-          const FakeCommand(command: <String>['git', 'add', '--all']),
-          const FakeCommand(command: <String>[
-            'git',
-            'commit',
-            "--message='add branch $candidateBranch to enabled_branches in .ci.yaml'",
-          ]),
-          const FakeCommand(
-            command: <String>['git', 'rev-parse', 'HEAD'],
-            stdout: revision2,
-          ),
-        ]);
+        final FakeProcessManager processManager = FakeProcessManager.empty();
         final FakePlatform platform = FakePlatform(
           environment: <String, String>{
             'HOME': <String>['path', 'to', 'home'].join(localPathSeparator),
@@ -228,16 +205,6 @@
               _initializeCiYamlFile(file);
             },
           ),
-          const FakeCommand(
-            command: <String>['git', 'status', '--porcelain'],
-            stdout: 'MM .ci.yaml',
-          ),
-          const FakeCommand(command: <String>['git', 'add', '--all']),
-          const FakeCommand(command: <String>['git', 'commit', "--message='add branch $candidateBranch to enabled_branches in .ci.yaml'"]),
-          const FakeCommand(
-            command: <String>['git', 'rev-parse', 'HEAD'],
-            stdout: revision2,
-          ),
           const FakeCommand(command: <String>['git', 'push', 'mirror', 'HEAD:refs/heads/$workingBranch']),
         ]);
         final FakePlatform platform = FakePlatform(
@@ -355,6 +322,7 @@
           fileSystem.file(stateFile),
         );
 
+        expect(processManager, hasNoRemainingExpectations);
         expect(stdio.stdout, contains('Has CI passed for the engine PR and binaries been codesigned? (y/n) '));
         expect(finalState.currentPhase, ReleasePhase.CODESIGN_ENGINE_BINARIES);
         expect(stdio.error.contains('Aborting command.'), true);
@@ -392,6 +360,7 @@
           fileSystem.file(stateFile),
         );
 
+        expect(processManager, hasNoRemainingExpectations);
         expect(stdio.stdout, contains('Has CI passed for the engine PR and binaries been codesigned? (y/n) '));
         expect(finalState.currentPhase, ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS);
       });
@@ -526,20 +495,6 @@
           ),
           const FakeCommand(
             command: <String>['git', 'status', '--porcelain'],
-            stdout: 'MM /path/to/.ci.yaml',
-          ),
-          const FakeCommand(command: <String>['git', 'add', '--all']),
-          const FakeCommand(command: <String>[
-            'git',
-            'commit',
-            "--message='add branch $candidateBranch to enabled_branches in .ci.yaml'",
-          ]),
-          const FakeCommand(
-            command: <String>['git', 'rev-parse', 'HEAD'],
-            stdout: revision3,
-          ),
-          const FakeCommand(
-            command: <String>['git', 'status', '--porcelain'],
             stdout: 'MM /path/to/engine.version',
           ),
           const FakeCommand(command: <String>['git', 'add', '--all']),
@@ -616,20 +571,6 @@
           const FakeCommand(command: <String>['git', 'checkout', workingBranch]),
           const FakeCommand(
             command: <String>['git', 'status', '--porcelain'],
-            stdout: 'MM path/to/.ci.yaml',
-          ),
-          const FakeCommand(command: <String>['git', 'add', '--all']),
-          const FakeCommand(command: <String>[
-            'git',
-            'commit',
-            "--message='add branch $candidateBranch to enabled_branches in .ci.yaml'",
-          ]),
-          const FakeCommand(
-            command: <String>['git', 'rev-parse', 'HEAD'],
-            stdout: revision3,
-          ),
-          const FakeCommand(
-            command: <String>['git', 'status', '--porcelain'],
             stdout: 'MM path/to/engine.version',
           ),
           const FakeCommand(command: <String>['git', 'add', '--all']),
@@ -700,20 +641,6 @@
           const FakeCommand(command: <String>[
             'git',
             'commit',
-            "--message='add branch $candidateBranch to enabled_branches in .ci.yaml'",
-          ]),
-          const FakeCommand(
-            command: <String>['git', 'rev-parse', 'HEAD'],
-            stdout: revision3,
-          ),
-          const FakeCommand(
-            command: <String>['git', 'status', '--porcelain'],
-            stdout: 'MM path/to/engine.version',
-          ),
-          const FakeCommand(command: <String>['git', 'add', '--all']),
-          const FakeCommand(command: <String>[
-            'git',
-            'commit',
             "--message='Update Engine revision to $revision1 for $releaseChannel release $releaseVersion'",
           ]),
           const FakeCommand(
diff --git a/dev/conductor/core/test/repository_test.dart b/dev/conductor/core/test/repository_test.dart
index 9c74618..5fe2f18 100644
--- a/dev/conductor/core/test/repository_test.dart
+++ b/dev/conductor/core/test/repository_test.dart
@@ -384,130 +384,6 @@
       );
     });
 
-    test('ciYaml.enableBranch() will prepend the given branch to the yaml list of enabled_branches', () async {
-      const String commit1 = 'abc123';
-      final File ciYaml = fileSystem.file('/flutter_conductor_checkouts/framework/.ci.yaml');
-      processManager.addCommands(<FakeCommand>[
-        FakeCommand(
-            command: <String>[
-          'git',
-          'clone',
-          '--origin',
-          'upstream',
-          '--',
-          FrameworkRepository.defaultUpstream,
-          fileSystem.path
-              .join(rootDir, 'flutter_conductor_checkouts', 'framework'),
-        ],
-        onRun: () {
-          ciYaml.createSync(recursive: true);
-          ciYaml.writeAsStringSync('''
-# Friendly note
-
-enabled_branches:
-  - ${FrameworkRepository.defaultBranch}
-  - dev
-  - beta
-  - stable
-''');
-        }),
-        const FakeCommand(command: <String>[
-          'git',
-          'checkout',
-          FrameworkRepository.defaultBranch,
-        ]),
-        const FakeCommand(command: <String>[
-          'git',
-          'rev-parse',
-          'HEAD',
-        ], stdout: commit1),
-      ]);
-      final Checkouts checkouts = Checkouts(
-        fileSystem: fileSystem,
-        parentDirectory: fileSystem.directory(rootDir),
-        platform: platform,
-        processManager: processManager,
-        stdio: stdio,
-      );
-
-      final FrameworkRepository framework = FrameworkRepository(checkouts);
-      expect(
-        (await framework.ciYaml).enabledBranches,
-        <String>[FrameworkRepository.defaultBranch, 'dev', 'beta', 'stable'],
-      );
-
-      (await framework.ciYaml).enableBranch('foo');
-      expect(
-        (await framework.ciYaml).enabledBranches,
-        <String>['foo', FrameworkRepository.defaultBranch, 'dev', 'beta', 'stable'],
-      );
-
-      expect(
-        (await framework.ciYaml).stringContents,
-        '''
-# Friendly note
-
-enabled_branches:
-  - foo
-  - ${FrameworkRepository.defaultBranch}
-  - dev
-  - beta
-  - stable
-'''
-      );
-    });
-
-    test('ciYaml.enableBranch() will throw if the input branch is already present in the yaml file', () {
-      const String commit1 = 'abc123';
-      final File ciYaml = fileSystem.file('/flutter_conductor_checkouts/framework/.ci.yaml');
-      processManager.addCommands(<FakeCommand>[
-        FakeCommand(
-            command: <String>[
-          'git',
-          'clone',
-          '--origin',
-          'upstream',
-          '--',
-          FrameworkRepository.defaultUpstream,
-          fileSystem.path
-              .join(rootDir, 'flutter_conductor_checkouts', 'framework'),
-        ],
-        onRun: () {
-          ciYaml.createSync(recursive: true);
-          ciYaml.writeAsStringSync('''
-enabled_branches:
-  - ${FrameworkRepository.defaultBranch}
-  - dev
-  - beta
-  - stable
-''');
-        }),
-        const FakeCommand(command: <String>[
-          'git',
-          'checkout',
-          FrameworkRepository.defaultBranch,
-        ]),
-        const FakeCommand(command: <String>[
-          'git',
-          'rev-parse',
-          'HEAD',
-        ], stdout: commit1),
-      ]);
-      final Checkouts checkouts = Checkouts(
-        fileSystem: fileSystem,
-        parentDirectory: fileSystem.directory(rootDir),
-        platform: platform,
-        processManager: processManager,
-        stdio: stdio,
-      );
-
-      final FrameworkRepository framework = FrameworkRepository(checkouts);
-      expect(
-        () async => (await framework.ciYaml).enableBranch(FrameworkRepository.defaultBranch),
-        throwsExceptionWith('.ci.yaml already contains the branch ${FrameworkRepository.defaultBranch}'),
-      );
-    });
-
     test('framework repo set as localUpstream ensures requiredLocalBranches exist locally', () async {
       const String commit = 'deadbeef';
       const String candidateBranch = 'flutter-1.2-candidate.3';
diff --git a/dev/conductor/core/test/start_test.dart b/dev/conductor/core/test/start_test.dart
index 7f5c6c6..88857c8 100644
--- a/dev/conductor/core/test/start_test.dart
+++ b/dev/conductor/core/test/start_test.dart
@@ -163,7 +163,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],
@@ -220,7 +220,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],
@@ -349,7 +349,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],
@@ -406,7 +406,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],
@@ -542,7 +542,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],
@@ -599,7 +599,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],
@@ -729,7 +729,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],
@@ -782,7 +782,7 @@
           command: <String>['git', 'fetch', 'mirror'],
         ),
         const FakeCommand(
-          command: <String>['git', 'checkout', candidateBranch],
+          command: <String>['git', 'checkout', 'upstream/$candidateBranch'],
         ),
         const FakeCommand(
           command: <String>['git', 'rev-parse', 'HEAD'],