checkout: Explicitly disable packfiles

Bug: b/370562298
Change-Id: Ib16d954b0513ed56ee9cbd90c2ff1201f66e87c2
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/239080
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Reviewed-by: Taylor Cramer <cramertj@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
diff --git a/recipe_modules/checkout/api.py b/recipe_modules/checkout/api.py
index bf6e124..8c9655f 100644
--- a/recipe_modules/checkout/api.py
+++ b/recipe_modules/checkout/api.py
@@ -974,7 +974,7 @@
         excluded_submodules: Sequence[str] | None = None,
         submodule_timeout_sec: int = 10 * 60,
         cache: bool = True,
-        use_packfiles: bool = True,
+        use_packfiles: bool = False,
         **kwargs,
     ):
         submodule_paths = included_submodules = included_submodules or []
@@ -1014,6 +1014,13 @@
                             step_name='set fetch.uriprotocols',
                             **kwargs,
                         )
+                    else:
+                        self.m.git.config(
+                            'fetch.uriprotocols',
+                            '',
+                            step_name='set fetch.uriprotocols',
+                            **kwargs,
+                        )
 
                     with self.m.default_timeout():
                         try:
diff --git a/recipe_modules/checkout/test_api.py b/recipe_modules/checkout/test_api.py
index 10d12cf..bc1df8a 100644
--- a/recipe_modules/checkout/test_api.py
+++ b/recipe_modules/checkout/test_api.py
@@ -157,6 +157,7 @@
         manifest_groups=(),
         rewrites=(),
         eligible_workspace_paths=(),
+        use_packfiles=True,
     ):
         props = checkout_options.Options()
         props.remote = remote
@@ -179,6 +180,7 @@
             checkout_options.Rewrite(original=x, final=y) for x, y in rewrites
         )
         props.eligible_workspace_paths.extend(eligible_workspace_paths)
+        props.do_not_use_packfiles = not use_packfiles
         return props
 
     def repo_options(
diff --git a/recipe_modules/checkout/tests/git.expected/try.json b/recipe_modules/checkout/tests/git.expected/try.json
index 09c4f47..e7cdb5f 100644
--- a/recipe_modules/checkout/tests/git.expected/try.json
+++ b/recipe_modules/checkout/tests/git.expected/try.json
@@ -11,7 +11,7 @@
     "name": "checkout pigweed.options",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_SUMMARY_TEXT@remote: \"https://pigweed.googlesource.com/pigweed/pigweed\"\nbranch: \"main\"\ninitialize_submodules: true\nmatch_branch: true\nuse_trigger: true\nroot_subdirectory: \"foo\"\n@@@"
+      "@@@STEP_SUMMARY_TEXT@remote: \"https://pigweed.googlesource.com/pigweed/pigweed\"\nbranch: \"main\"\ninitialize_submodules: true\nmatch_branch: true\nuse_trigger: true\nroot_subdirectory: \"foo\"\ndo_not_use_packfiles: true\n@@@"
     ]
   },
   {
@@ -19,7 +19,7 @@
     "name": "checkout pigweed.options with defaults",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_SUMMARY_TEXT@remote: \"https://pigweed.googlesource.com/pigweed/pigweed\"\nbranch: \"main\"\nmanifest_file: \"default.xml\"\ninitialize_submodules: true\nrepo_init_timeout_sec: 20\nrepo_sync_timeout_sec: 120\nnumber_of_attempts: 3\nmatch_branch: true\nsubmodule_timeout_sec: 600\nuse_trigger: true\nroot_subdirectory: \"foo\"\n@@@"
+      "@@@STEP_SUMMARY_TEXT@remote: \"https://pigweed.googlesource.com/pigweed/pigweed\"\nbranch: \"main\"\nmanifest_file: \"default.xml\"\ninitialize_submodules: true\nrepo_init_timeout_sec: 20\nrepo_sync_timeout_sec: 120\nnumber_of_attempts: 3\nmatch_branch: true\nsubmodule_timeout_sec: 600\nuse_trigger: true\nroot_subdirectory: \"foo\"\ndo_not_use_packfiles: true\n@@@"
     ]
   },
   {
@@ -491,7 +491,7 @@
       "git",
       "config",
       "fetch.uriprotocols",
-      "https"
+      ""
     ],
     "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
     "infra_step": true,
@@ -831,33 +831,6 @@
   {
     "cmd": [
       "git",
-      "config",
-      "fetch.uriprotocols",
-      "https"
-    ],
-    "cwd": "[START_DIR]/co",
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "project:try"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "checkout pigweed.git checkout.set fetch.uriprotocols",
-    "timeout": 300.0,
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
       "fetch",
       "--tags",
       "--jobs",
diff --git a/recipe_modules/checkout/tests/git.py b/recipe_modules/checkout/tests/git.py
index 5dfc7dd..080e44f 100644
--- a/recipe_modules/checkout/tests/git.py
+++ b/recipe_modules/checkout/tests/git.py
@@ -87,7 +87,7 @@
 
     yield api.test(
         'try',
-        properties(root_subdirectory='foo'),
+        properties(root_subdirectory='foo', use_packfiles=False),
         api.checkout.try_test_data(),
         api.checkout.cl_branch_parents(num_parents=2),
     )