Fix release candidate branch detection.

The remote branches were not being detected correctly because they were
prefixed with white spaces. This will also fix the problems with
codesigning.

Bug: https://github.com/flutter/flutter/issues/131942
Change-Id: I5a734c81a46e6bdf24e278d201784abaf239ca8b
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/48980
Reviewed-by: Xilai Zhang <xilaizhang@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
(cherry picked from commit 9ec4fbc67c9f0bfdff7ea5ec7a90b140dea750cc)
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/49020
diff --git a/recipe_modules/adhoc_validation/api.py b/recipe_modules/adhoc_validation/api.py
index f6a66bc..b04cb8c 100644
--- a/recipe_modules/adhoc_validation/api.py
+++ b/recipe_modules/adhoc_validation/api.py
@@ -79,7 +79,6 @@
            ) and self.m.repo_util.is_release_candidate_branch(checkout_path):
           env['LUCI_BRANCH'] = 'stable'
           env['LUCI_CI'] = True
-
         with self.m.context(env=env, env_prefixes=env_prefixes):
           self.m.flutter_bcid.report_stage(BcidStage.COMPILE.value)
           self.m.file.read_text(
diff --git a/recipe_modules/repo_util/api.py b/recipe_modules/repo_util/api.py
index b676d3a..61eed9d 100644
--- a/recipe_modules/repo_util/api.py
+++ b/recipe_modules/repo_util/api.py
@@ -333,9 +333,12 @@
             stdout=self.m.raw_io.output_text()
         ).stdout.splitlines()
         # Discard local branches as we are interested only in remote branches.
-        branches = [b for b in branches if b.startswith('remotes/origin/')]
-        return [b.strip().replace('remotes/origin/', '') for b in branches
-               ] or []
+        branches = [
+            b.strip()
+            for b in branches
+            if b.strip().startswith('remotes/origin/')
+        ]
+        return [b.replace('remotes/origin/', '') for b in branches] or []
 
   def get_branch(self, checkout_path):
     """Get git branch for beta and stable channels.