We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
remote-build: add control logic when the project is in a git repo
### What needs to get done

This adds control logic to determine whether to execute the new or legacy remote-build code.

If the project is not part of a git repository, then execute the legacy remote-build code.  Otherwise, execute the new remote-build code.

This check can be done by using the GitPython wrapper class (#4320).

![image](https://github.com/snapcore/snapcraft/assets/60674096/43c278ad-9ac7-4040-9f9e-3f87528c7e22)

### Why it needs to get done

This check exists to minimize changes for existing workflows.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `snapcraft/commands/remote.py`
Content:
```
1 # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
2 #
3 # Copyright 2022-2023 Canonical Ltd.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 3 as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 
17 """Snapcraft remote build command."""
18 
19 import argparse
20 import os
21 import textwrap
22 from enum import Enum
23 from typing import Optional
24 
25 from craft_cli import BaseCommand, emit
26 from craft_cli.helptexts import HIDDEN
27 from overrides import overrides
28 
29 from snapcraft.errors import MaintenanceBase, SnapcraftError
30 from snapcraft.legacy_cli import run_legacy
31 from snapcraft.parts import yaml_utils
32 from snapcraft.utils import confirm_with_user, humanize_list
33 from snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError
34 
35 _CONFIRMATION_PROMPT = (
36     "All data sent to remote builders will be publicly available. "
37     "Are you sure you want to continue?"
38 )
39 
40 
41 _STRATEGY_ENVVAR = "SNAPCRAFT_REMOTE_BUILD_STRATEGY"
42 
43 
44 class _Strategies(Enum):
45     """Possible values of the build strategy."""
46 
47     DISABLE_FALLBACK = "disable-fallback"
48     FORCE_FALLBACK = "force-fallback"
49 
50 
51 class RemoteBuildCommand(BaseCommand):
52     """Command passthrough for the remote-build command."""
53 
54     name = "remote-build"
55     help_msg = "Dispatch a snap for remote build"
56     overview = textwrap.dedent(
57         """
58         Command remote-build sends the current project to be built
59         remotely.  After the build is complete, packages for each
60         architecture are retrieved and will be available in the
61         local filesystem.
62 
63         If not specified in the snapcraft.yaml file, the list of
64         architectures to build can be set using the --build-on option.
65         If both are specified, an error will occur.
66 
67         Interrupted remote builds can be resumed using the --recover
68         option, followed by the build number informed when the remote
69         build was originally dispatched. The current state of the
70         remote build for each architecture can be checked using the
71         --status option."""
72     )
73 
74     @overrides
75     def fill_parser(self, parser: argparse.ArgumentParser) -> None:
76         parser.add_argument(
77             "--recover", action="store_true", help="recover an interrupted build"
78         )
79         parser.add_argument(
80             "--status", action="store_true", help="display remote build status"
81         )
82         parser_target = parser.add_mutually_exclusive_group()
83         parser_target.add_argument(
84             "--build-on",
85             metavar="arch",
86             nargs="+",
87             help=HIDDEN,
88         )
89         parser_target.add_argument(
90             "--build-for",
91             metavar="arch",
92             nargs="+",
93             help="architecture to build for",
94         )
95         parser.add_argument(
96             "--build-id", metavar="build-id", help="specific build id to retrieve"
97         )
98         parser.add_argument(
99             "--launchpad-accept-public-upload",
100             action="store_true",
101             help="acknowledge that uploaded code will be publicly available.",
102         )
103 
104     def _get_build_strategy(self) -> Optional[_Strategies]:
105         """Get the build strategy from the envvar `SNAPCRAFT_REMOTE_BUILD_STRATEGY`.
106 
107         :returns: The strategy or None.
108 
109         :raises SnapcraftError: If the variable is set to an invalid value.
110         """
111         strategy = os.getenv(_STRATEGY_ENVVAR)
112 
113         if not strategy:
114             return None
115 
116         try:
117             return _Strategies(strategy)
118         except ValueError as err:
119             valid_strategies = humanize_list(
120                 (strategy.value for strategy in _Strategies), "and"
121             )
122             raise SnapcraftError(
123                 f"Unknown value {strategy!r} in environment variable "
124                 f"{_STRATEGY_ENVVAR!r}. Valid values are {valid_strategies}."
125             ) from err
126 
127     def _get_effective_base(self) -> str:
128         """Get a valid effective base from the project's snapcraft.yaml.
129 
130         :returns: The project's effective base.
131 
132         :raises SnapcraftError: If the base is unknown or missing or if the
133         snapcraft.yaml cannot be loaded.
134         :raises MaintenanceBase: If the base is not supported
135         """
136         snapcraft_yaml = yaml_utils.get_snap_project().project_file
137 
138         with open(snapcraft_yaml, encoding="utf-8") as file:
139             base = yaml_utils.get_base(file)
140 
141         if base is None:
142             raise SnapcraftError(
143                 f"Could not determine base from {str(snapcraft_yaml)!r}."
144             )
145 
146         emit.debug(f"Got base {base!r} from {str(snapcraft_yaml)!r}.")
147 
148         if base in yaml_utils.ESM_BASES:
149             raise MaintenanceBase(base)
150 
151         if base not in yaml_utils.BASES:
152             raise SnapcraftError(f"Unknown base {base!r} in {str(snapcraft_yaml)!r}.")
153 
154         return base
155 
156     def _run_remote_build(self, base: str) -> None:
157         # bases newer than core22 must use the new remote-build
158         if base in yaml_utils.CURRENT_BASES - {"core22"}:
159             emit.debug(
160                 "Using fallback remote-build because new remote-build is not available."
161             )
162             # TODO: use new remote-build code (#4323)
163             run_legacy()
164             return
165 
166         strategy = self._get_build_strategy()
167 
168         if strategy == _Strategies.DISABLE_FALLBACK:
169             emit.debug(
170                 f"Environment variable {_STRATEGY_ENVVAR!r} is "
171                 f"{_Strategies.DISABLE_FALLBACK.value!r} but running fallback "
172                 "remote-build because new remote-build is not available."
173             )
174             run_legacy()
175             return
176 
177         if strategy == _Strategies.FORCE_FALLBACK:
178             emit.debug(
179                 "Running fallback remote-build because environment variable "
180                 f"{_STRATEGY_ENVVAR!r} is {_Strategies.FORCE_FALLBACK.value!r}."
181             )
182             run_legacy()
183             return
184 
185         emit.debug("Running fallback remote-build.")
186         run_legacy()
187 
188     @overrides
189     def run(self, parsed_args) -> None:
190         if os.getenv("SUDO_USER") and os.geteuid() == 0:
191             emit.message(
192                 "Running with 'sudo' may cause permission errors and is discouraged."
193             )
194 
195         emit.message(
196             "snapcraft remote-build is experimental and is subject to change "
197             "- use with caution."
198         )
199 
200         if parsed_args.build_on:
201             emit.message("Use --build-for instead of --build-on")
202             parsed_args.build_for = parsed_args.build_on
203 
204         if not parsed_args.launchpad_accept_public_upload and not confirm_with_user(
205             _CONFIRMATION_PROMPT
206         ):
207             raise AcceptPublicUploadError()
208 
209         base = self._get_effective_base()
210         self._run_remote_build(base)
211
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/snapcraft/commands/remote.py b/snapcraft/commands/remote.py
--- a/snapcraft/commands/remote.py
+++ b/snapcraft/commands/remote.py
@@ -20,6 +20,7 @@
 import os
 import textwrap
 from enum import Enum
+from pathlib import Path
 from typing import Optional
 
 from craft_cli import BaseCommand, emit
@@ -29,6 +30,7 @@
 from snapcraft.errors import MaintenanceBase, SnapcraftError
 from snapcraft.legacy_cli import run_legacy
 from snapcraft.parts import yaml_utils
+from snapcraft.remote import is_repo
 from snapcraft.utils import confirm_with_user, humanize_list
 from snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError
 
@@ -182,6 +184,14 @@
             run_legacy()
             return
 
+        if is_repo(Path().absolute()):
+            emit.debug(
+                "Project is in a git repository but running fallback remote-build "
+                "because new remote-build is not available."
+            )
+            run_legacy()
+            return
+
         emit.debug("Running fallback remote-build.")
         run_legacy()

{"golden_diff": "diff --git a/snapcraft/commands/remote.py b/snapcraft/commands/remote.py\n--- a/snapcraft/commands/remote.py\n+++ b/snapcraft/commands/remote.py\n@@ -20,6 +20,7 @@\n import os\n import textwrap\n from enum import Enum\n+from pathlib import Path\n from typing import Optional\n \n from craft_cli import BaseCommand, emit\n@@ -29,6 +30,7 @@\n from snapcraft.errors import MaintenanceBase, SnapcraftError\n from snapcraft.legacy_cli import run_legacy\n from snapcraft.parts import yaml_utils\n+from snapcraft.remote import is_repo\n from snapcraft.utils import confirm_with_user, humanize_list\n from snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError\n \n@@ -182,6 +184,14 @@\n             run_legacy()\n             return\n \n+        if is_repo(Path().absolute()):\n+            emit.debug(\n+                \"Project is in a git repository but running fallback remote-build \"\n+                \"because new remote-build is not available.\"\n+            )\n+            run_legacy()\n+            return\n+\n         emit.debug(\"Running fallback remote-build.\")\n         run_legacy()\n", "issue": "remote-build: add control logic when the project is in a git repo\n### What needs to get done\n\nThis adds control logic to determine whether to execute the new or legacy remote-build code.\r\n\r\nIf the project is not part of a git repository, then execute the legacy remote-build code.  Otherwise, execute the new remote-build code.\r\n\r\nThis check can be done by using the GitPython wrapper class (#4320).\r\n\r\n![image](https://github.com/snapcore/snapcraft/assets/60674096/43c278ad-9ac7-4040-9f9e-3f87528c7e22)\n\n### Why it needs to get done\n\nThis check exists to minimize changes for existing workflows.\n", "before_files": [{"content": "# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-\n#\n# Copyright 2022-2023 Canonical Ltd.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 3 as\n# published by the Free Software Foundation.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"Snapcraft remote build command.\"\"\"\n\nimport argparse\nimport os\nimport textwrap\nfrom enum import Enum\nfrom typing import Optional\n\nfrom craft_cli import BaseCommand, emit\nfrom craft_cli.helptexts import HIDDEN\nfrom overrides import overrides\n\nfrom snapcraft.errors import MaintenanceBase, SnapcraftError\nfrom snapcraft.legacy_cli import run_legacy\nfrom snapcraft.parts import yaml_utils\nfrom snapcraft.utils import confirm_with_user, humanize_list\nfrom snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError\n\n_CONFIRMATION_PROMPT = (\n    \"All data sent to remote builders will be publicly available. \"\n    \"Are you sure you want to continue?\"\n)\n\n\n_STRATEGY_ENVVAR = \"SNAPCRAFT_REMOTE_BUILD_STRATEGY\"\n\n\nclass _Strategies(Enum):\n    \"\"\"Possible values of the build strategy.\"\"\"\n\n    DISABLE_FALLBACK = \"disable-fallback\"\n    FORCE_FALLBACK = \"force-fallback\"\n\n\nclass RemoteBuildCommand(BaseCommand):\n    \"\"\"Command passthrough for the remote-build command.\"\"\"\n\n    name = \"remote-build\"\n    help_msg = \"Dispatch a snap for remote build\"\n    overview = textwrap.dedent(\n        \"\"\"\n        Command remote-build sends the current project to be built\n        remotely.  After the build is complete, packages for each\n        architecture are retrieved and will be available in the\n        local filesystem.\n\n        If not specified in the snapcraft.yaml file, the list of\n        architectures to build can be set using the --build-on option.\n        If both are specified, an error will occur.\n\n        Interrupted remote builds can be resumed using the --recover\n        option, followed by the build number informed when the remote\n        build was originally dispatched. The current state of the\n        remote build for each architecture can be checked using the\n        --status option.\"\"\"\n    )\n\n    @overrides\n    def fill_parser(self, parser: argparse.ArgumentParser) -> None:\n        parser.add_argument(\n            \"--recover\", action=\"store_true\", help=\"recover an interrupted build\"\n        )\n        parser.add_argument(\n            \"--status\", action=\"store_true\", help=\"display remote build status\"\n        )\n        parser_target = parser.add_mutually_exclusive_group()\n        parser_target.add_argument(\n            \"--build-on\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=HIDDEN,\n        )\n        parser_target.add_argument(\n            \"--build-for\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=\"architecture to build for\",\n        )\n        parser.add_argument(\n            \"--build-id\", metavar=\"build-id\", help=\"specific build id to retrieve\"\n        )\n        parser.add_argument(\n            \"--launchpad-accept-public-upload\",\n            action=\"store_true\",\n            help=\"acknowledge that uploaded code will be publicly available.\",\n        )\n\n    def _get_build_strategy(self) -> Optional[_Strategies]:\n        \"\"\"Get the build strategy from the envvar `SNAPCRAFT_REMOTE_BUILD_STRATEGY`.\n\n        :returns: The strategy or None.\n\n        :raises SnapcraftError: If the variable is set to an invalid value.\n        \"\"\"\n        strategy = os.getenv(_STRATEGY_ENVVAR)\n\n        if not strategy:\n            return None\n\n        try:\n            return _Strategies(strategy)\n        except ValueError as err:\n            valid_strategies = humanize_list(\n                (strategy.value for strategy in _Strategies), \"and\"\n            )\n            raise SnapcraftError(\n                f\"Unknown value {strategy!r} in environment variable \"\n                f\"{_STRATEGY_ENVVAR!r}. Valid values are {valid_strategies}.\"\n            ) from err\n\n    def _get_effective_base(self) -> str:\n        \"\"\"Get a valid effective base from the project's snapcraft.yaml.\n\n        :returns: The project's effective base.\n\n        :raises SnapcraftError: If the base is unknown or missing or if the\n        snapcraft.yaml cannot be loaded.\n        :raises MaintenanceBase: If the base is not supported\n        \"\"\"\n        snapcraft_yaml = yaml_utils.get_snap_project().project_file\n\n        with open(snapcraft_yaml, encoding=\"utf-8\") as file:\n            base = yaml_utils.get_base(file)\n\n        if base is None:\n            raise SnapcraftError(\n                f\"Could not determine base from {str(snapcraft_yaml)!r}.\"\n            )\n\n        emit.debug(f\"Got base {base!r} from {str(snapcraft_yaml)!r}.\")\n\n        if base in yaml_utils.ESM_BASES:\n            raise MaintenanceBase(base)\n\n        if base not in yaml_utils.BASES:\n            raise SnapcraftError(f\"Unknown base {base!r} in {str(snapcraft_yaml)!r}.\")\n\n        return base\n\n    def _run_remote_build(self, base: str) -> None:\n        # bases newer than core22 must use the new remote-build\n        if base in yaml_utils.CURRENT_BASES - {\"core22\"}:\n            emit.debug(\n                \"Using fallback remote-build because new remote-build is not available.\"\n            )\n            # TODO: use new remote-build code (#4323)\n            run_legacy()\n            return\n\n        strategy = self._get_build_strategy()\n\n        if strategy == _Strategies.DISABLE_FALLBACK:\n            emit.debug(\n                f\"Environment variable {_STRATEGY_ENVVAR!r} is \"\n                f\"{_Strategies.DISABLE_FALLBACK.value!r} but running fallback \"\n                \"remote-build because new remote-build is not available.\"\n            )\n            run_legacy()\n            return\n\n        if strategy == _Strategies.FORCE_FALLBACK:\n            emit.debug(\n                \"Running fallback remote-build because environment variable \"\n                f\"{_STRATEGY_ENVVAR!r} is {_Strategies.FORCE_FALLBACK.value!r}.\"\n            )\n            run_legacy()\n            return\n\n        emit.debug(\"Running fallback remote-build.\")\n        run_legacy()\n\n    @overrides\n    def run(self, parsed_args) -> None:\n        if os.getenv(\"SUDO_USER\") and os.geteuid() == 0:\n            emit.message(\n                \"Running with 'sudo' may cause permission errors and is discouraged.\"\n            )\n\n        emit.message(\n            \"snapcraft remote-build is experimental and is subject to change \"\n            \"- use with caution.\"\n        )\n\n        if parsed_args.build_on:\n            emit.message(\"Use --build-for instead of --build-on\")\n            parsed_args.build_for = parsed_args.build_on\n\n        if not parsed_args.launchpad_accept_public_upload and not confirm_with_user(\n            _CONFIRMATION_PROMPT\n        ):\n            raise AcceptPublicUploadError()\n\n        base = self._get_effective_base()\n        self._run_remote_build(base)\n", "path": "snapcraft/commands/remote.py"}], "after_files": [{"content": "# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-\n#\n# Copyright 2022-2023 Canonical Ltd.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 3 as\n# published by the Free Software Foundation.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\"\"\"Snapcraft remote build command.\"\"\"\n\nimport argparse\nimport os\nimport textwrap\nfrom enum import Enum\nfrom pathlib import Path\nfrom typing import Optional\n\nfrom craft_cli import BaseCommand, emit\nfrom craft_cli.helptexts import HIDDEN\nfrom overrides import overrides\n\nfrom snapcraft.errors import MaintenanceBase, SnapcraftError\nfrom snapcraft.legacy_cli import run_legacy\nfrom snapcraft.parts import yaml_utils\nfrom snapcraft.remote import is_repo\nfrom snapcraft.utils import confirm_with_user, humanize_list\nfrom snapcraft_legacy.internal.remote_build.errors import AcceptPublicUploadError\n\n_CONFIRMATION_PROMPT = (\n    \"All data sent to remote builders will be publicly available. \"\n    \"Are you sure you want to continue?\"\n)\n\n\n_STRATEGY_ENVVAR = \"SNAPCRAFT_REMOTE_BUILD_STRATEGY\"\n\n\nclass _Strategies(Enum):\n    \"\"\"Possible values of the build strategy.\"\"\"\n\n    DISABLE_FALLBACK = \"disable-fallback\"\n    FORCE_FALLBACK = \"force-fallback\"\n\n\nclass RemoteBuildCommand(BaseCommand):\n    \"\"\"Command passthrough for the remote-build command.\"\"\"\n\n    name = \"remote-build\"\n    help_msg = \"Dispatch a snap for remote build\"\n    overview = textwrap.dedent(\n        \"\"\"\n        Command remote-build sends the current project to be built\n        remotely.  After the build is complete, packages for each\n        architecture are retrieved and will be available in the\n        local filesystem.\n\n        If not specified in the snapcraft.yaml file, the list of\n        architectures to build can be set using the --build-on option.\n        If both are specified, an error will occur.\n\n        Interrupted remote builds can be resumed using the --recover\n        option, followed by the build number informed when the remote\n        build was originally dispatched. The current state of the\n        remote build for each architecture can be checked using the\n        --status option.\"\"\"\n    )\n\n    @overrides\n    def fill_parser(self, parser: argparse.ArgumentParser) -> None:\n        parser.add_argument(\n            \"--recover\", action=\"store_true\", help=\"recover an interrupted build\"\n        )\n        parser.add_argument(\n            \"--status\", action=\"store_true\", help=\"display remote build status\"\n        )\n        parser_target = parser.add_mutually_exclusive_group()\n        parser_target.add_argument(\n            \"--build-on\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=HIDDEN,\n        )\n        parser_target.add_argument(\n            \"--build-for\",\n            metavar=\"arch\",\n            nargs=\"+\",\n            help=\"architecture to build for\",\n        )\n        parser.add_argument(\n            \"--build-id\", metavar=\"build-id\", help=\"specific build id to retrieve\"\n        )\n        parser.add_argument(\n            \"--launchpad-accept-public-upload\",\n            action=\"store_true\",\n            help=\"acknowledge that uploaded code will be publicly available.\",\n        )\n\n    def _get_build_strategy(self) -> Optional[_Strategies]:\n        \"\"\"Get the build strategy from the envvar `SNAPCRAFT_REMOTE_BUILD_STRATEGY`.\n\n        :returns: The strategy or None.\n\n        :raises SnapcraftError: If the variable is set to an invalid value.\n        \"\"\"\n        strategy = os.getenv(_STRATEGY_ENVVAR)\n\n        if not strategy:\n            return None\n\n        try:\n            return _Strategies(strategy)\n        except ValueError as err:\n            valid_strategies = humanize_list(\n                (strategy.value for strategy in _Strategies), \"and\"\n            )\n            raise SnapcraftError(\n                f\"Unknown value {strategy!r} in environment variable \"\n                f\"{_STRATEGY_ENVVAR!r}. Valid values are {valid_strategies}.\"\n            ) from err\n\n    def _get_effective_base(self) -> str:\n        \"\"\"Get a valid effective base from the project's snapcraft.yaml.\n\n        :returns: The project's effective base.\n\n        :raises SnapcraftError: If the base is unknown or missing or if the\n        snapcraft.yaml cannot be loaded.\n        :raises MaintenanceBase: If the base is not supported\n        \"\"\"\n        snapcraft_yaml = yaml_utils.get_snap_project().project_file\n\n        with open(snapcraft_yaml, encoding=\"utf-8\") as file:\n            base = yaml_utils.get_base(file)\n\n        if base is None:\n            raise SnapcraftError(\n                f\"Could not determine base from {str(snapcraft_yaml)!r}.\"\n            )\n\n        emit.debug(f\"Got base {base!r} from {str(snapcraft_yaml)!r}.\")\n\n        if base in yaml_utils.ESM_BASES:\n            raise MaintenanceBase(base)\n\n        if base not in yaml_utils.BASES:\n            raise SnapcraftError(f\"Unknown base {base!r} in {str(snapcraft_yaml)!r}.\")\n\n        return base\n\n    def _run_remote_build(self, base: str) -> None:\n        # bases newer than core22 must use the new remote-build\n        if base in yaml_utils.CURRENT_BASES - {\"core22\"}:\n            emit.debug(\n                \"Using fallback remote-build because new remote-build is not available.\"\n            )\n            # TODO: use new remote-build code (#4323)\n            run_legacy()\n            return\n\n        strategy = self._get_build_strategy()\n\n        if strategy == _Strategies.DISABLE_FALLBACK:\n            emit.debug(\n                f\"Environment variable {_STRATEGY_ENVVAR!r} is \"\n                f\"{_Strategies.DISABLE_FALLBACK.value!r} but running fallback \"\n                \"remote-build because new remote-build is not available.\"\n            )\n            run_legacy()\n            return\n\n        if strategy == _Strategies.FORCE_FALLBACK:\n            emit.debug(\n                \"Running fallback remote-build because environment variable \"\n                f\"{_STRATEGY_ENVVAR!r} is {_Strategies.FORCE_FALLBACK.value!r}.\"\n            )\n            run_legacy()\n            return\n\n        if is_repo(Path().absolute()):\n            emit.debug(\n                \"Project is in a git repository but running fallback remote-build \"\n                \"because new remote-build is not available.\"\n            )\n            run_legacy()\n            return\n\n        emit.debug(\"Running fallback remote-build.\")\n        run_legacy()\n\n    @overrides\n    def run(self, parsed_args) -> None:\n        if os.getenv(\"SUDO_USER\") and os.geteuid() == 0:\n            emit.message(\n                \"Running with 'sudo' may cause permission errors and is discouraged.\"\n            )\n\n        emit.message(\n            \"snapcraft remote-build is experimental and is subject to change \"\n            \"- use with caution.\"\n        )\n\n        if parsed_args.build_on:\n            emit.message(\"Use --build-for instead of --build-on\")\n            parsed_args.build_for = parsed_args.build_on\n\n        if not parsed_args.launchpad_accept_public_upload and not confirm_with_user(\n            _CONFIRMATION_PROMPT\n        ):\n            raise AcceptPublicUploadError()\n\n        base = self._get_effective_base()\n        self._run_remote_build(base)\n", "path": "snapcraft/commands/remote.py"}]}