Recipe was always checking out head.

This was causing breaking the tree as it was using the latest from
master to test changes instead of the source code under test.

Change-Id: Ieb57020dc0de4202a694840daffdc8bb0fd5e822
Bug: https://github.com/flutter/flutter/issues/57068
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/2823
Reviewed-by: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipes/recipes.expected/ci.json b/recipes/recipes.expected/ci.json
new file mode 100644
index 0000000..1ee0d36
--- /dev/null
+++ b/recipes/recipes.expected/ci.json
@@ -0,0 +1,604 @@
+[
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[START_DIR]/recipes"
+    ],
+    "infra_step": true,
+    "name": "makedirs"
+  },
+  {
+    "cmd": [
+      "git",
+      "init"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git init"
+  },
+  {
+    "cmd": [
+      "git",
+      "remote",
+      "add",
+      "origin",
+      "https://flutter.googlesource.com/recipes"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git remote"
+  },
+  {
+    "cmd": [],
+    "name": "cache"
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[CACHE]/git/flutter.googlesource.com-recipes"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "cache.makedirs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "init",
+      "--bare"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.git init",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "config",
+      "remote.origin.url",
+      "https://flutter.googlesource.com/recipes"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.remote set-url",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "config",
+      "--replace-all",
+      "remote.origin.fetch",
+      "+refs/heads/*:refs/heads/*",
+      "\\+refs/heads/\\*:.*"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.git config",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "fetch",
+      "--prune",
+      "--tags",
+      "origin"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.git fetch",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[START_DIR]/recipes/.git/objects/info"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "cache.makedirs object/info",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CACHE]/git/flutter.googlesource.com-recipes/objects\n",
+      "[START_DIR]/recipes/.git/objects/info/alternates"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "cache.alternates",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@alternates@[CACHE]/git/flutter.googlesource.com-recipes/objects@@@",
+      "@@@STEP_LOG_END@alternates@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "fetch",
+      "--tags",
+      "origin",
+      "master"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git fetch"
+  },
+  {
+    "cmd": [
+      "git",
+      "checkout",
+      "-f",
+      "FETCH_HEAD"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git checkout"
+  },
+  {
+    "cmd": [
+      "git",
+      "rev-parse",
+      "HEAD"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git rev-parse"
+  },
+  {
+    "cmd": [
+      "git",
+      "clean",
+      "-f",
+      "-d",
+      "-x"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git clean"
+  },
+  {
+    "cmd": [],
+    "name": "submodule"
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "submodule.git submodule sync",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
+      "update",
+      "--init"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "submodule.git submodule update",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/recipes/recipes.py",
+      "lint"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "name": "lint"
+  },
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[START_DIR]/recipes/recipes.py",
+      "test",
+      "run"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "name": "test"
+  },
+  {
+    "cmd": [],
+    "name": "get commit-queue"
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::url]/resources/pycurl.py",
+      "--url",
+      "https://luci-config.appspot.com/_ah/api/config/v1/config_sets/projects/flutter/config/commit-queue.cfg",
+      "--status-json",
+      "/path/to/tmp/json",
+      "--outfile",
+      "/path/to/tmp/json"
+    ],
+    "name": "get commit-queue.get",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "get commit-queue.response",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@decoded@@@@",
+      "@@@STEP_LOG_LINE@decoded@    submit_options: <@@@",
+      "@@@STEP_LOG_LINE@decoded@      max_burst: 4@@@",
+      "@@@STEP_LOG_LINE@decoded@      burst_delay: <@@@",
+      "@@@STEP_LOG_LINE@decoded@        seconds: 480@@@",
+      "@@@STEP_LOG_LINE@decoded@      >@@@",
+      "@@@STEP_LOG_LINE@decoded@    >@@@",
+      "@@@STEP_LOG_LINE@decoded@    config_groups: <@@@",
+      "@@@STEP_LOG_LINE@decoded@      gerrit: <@@@",
+      "@@@STEP_LOG_LINE@decoded@        url: \"https://flutter-review.googlesource.com\"@@@",
+      "@@@STEP_LOG_LINE@decoded@        projects: <@@@",
+      "@@@STEP_LOG_LINE@decoded@          name: \"project\"@@@",
+      "@@@STEP_LOG_LINE@decoded@          ref_regexp: \"refs/heads/.+\"@@@",
+      "@@@STEP_LOG_LINE@decoded@        >@@@",
+      "@@@STEP_LOG_LINE@decoded@      >@@@",
+      "@@@STEP_LOG_LINE@decoded@      verifiers: <@@@",
+      "@@@STEP_LOG_LINE@decoded@        gerrit_cq_ability: <@@@",
+      "@@@STEP_LOG_LINE@decoded@          committer_list: \"project-flutter-committers\"@@@",
+      "@@@STEP_LOG_LINE@decoded@          dry_run_access_list: \"project-flutter-tryjob-access\"@@@",
+      "@@@STEP_LOG_LINE@decoded@        >@@@",
+      "@@@STEP_LOG_LINE@decoded@        tryjob: <@@@",
+      "@@@STEP_LOG_LINE@decoded@          builders: <@@@",
+      "@@@STEP_LOG_LINE@decoded@            name: \"flutter/try/flutter-baz\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp: \".*\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp_exclude: \".+/[+]/.*\\.md\"@@@",
+      "@@@STEP_LOG_LINE@decoded@          >@@@",
+      "@@@STEP_LOG_LINE@decoded@        >@@@",
+      "@@@STEP_LOG_LINE@decoded@      >@@@",
+      "@@@STEP_LOG_LINE@decoded@    >@@@",
+      "@@@STEP_LOG_LINE@decoded@    config_groups: <@@@",
+      "@@@STEP_LOG_LINE@decoded@      gerrit: <@@@",
+      "@@@STEP_LOG_LINE@decoded@        url: \"https://flutter-review.googlesource.com\"@@@",
+      "@@@STEP_LOG_LINE@decoded@        projects: <@@@",
+      "@@@STEP_LOG_LINE@decoded@          name: \"flutter/flutter\"@@@",
+      "@@@STEP_LOG_LINE@decoded@          ref_regexp: \"refs/heads/.+\"@@@",
+      "@@@STEP_LOG_LINE@decoded@        >@@@",
+      "@@@STEP_LOG_LINE@decoded@      >@@@",
+      "@@@STEP_LOG_LINE@decoded@      verifiers: <@@@",
+      "@@@STEP_LOG_LINE@decoded@        gerrit_cq_ability: <@@@",
+      "@@@STEP_LOG_LINE@decoded@          committer_list: \"project-flutter-committers\"@@@",
+      "@@@STEP_LOG_LINE@decoded@          dry_run_access_list: \"project-flutter-tryjob-access\"@@@",
+      "@@@STEP_LOG_LINE@decoded@        >@@@",
+      "@@@STEP_LOG_LINE@decoded@        tryjob: <@@@",
+      "@@@STEP_LOG_LINE@decoded@          builders: <@@@",
+      "@@@STEP_LOG_LINE@decoded@            name: \"flutter/try/flutter-bar\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp: \".*\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp_exclude: \".+/[+]/.*\\.md\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp_exclude: \".+/[+].*/docs/.+\"@@@",
+      "@@@STEP_LOG_LINE@decoded@          >@@@",
+      "@@@STEP_LOG_LINE@decoded@          builders: <@@@",
+      "@@@STEP_LOG_LINE@decoded@            name: \"flutter/try/flutter-foo\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp: \".*\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp_exclude: \".+/[+]/.*\\.md\"@@@",
+      "@@@STEP_LOG_LINE@decoded@            location_regexp_exclude: \".+/[+].*/docs/.+\"@@@",
+      "@@@STEP_LOG_LINE@decoded@          >@@@",
+      "@@@STEP_LOG_LINE@decoded@        >@@@",
+      "@@@STEP_LOG_LINE@decoded@      >@@@",
+      "@@@STEP_LOG_LINE@decoded@    >@@@",
+      "@@@STEP_LOG_END@decoded@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "all_tryjobs",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@tryjobs@flutter/try/flutter-bar@@@",
+      "@@@STEP_LOG_LINE@tryjobs@flutter/try/flutter-baz@@@",
+      "@@@STEP_LOG_LINE@tryjobs@flutter/try/flutter-foo@@@",
+      "@@@STEP_LOG_END@tryjobs@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "normalized_tryjobs",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@tryjobs@flutter/try/flutter-bar@@@",
+      "@@@STEP_LOG_LINE@tryjobs@flutter/try/flutter-baz@@@",
+      "@@@STEP_LOG_LINE@tryjobs@flutter/try/flutter-foo@@@",
+      "@@@STEP_LOG_END@tryjobs@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "get_affected_recipes",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@all recipes@fuchsia@@@",
+      "@@@STEP_LOG_LINE@all recipes@recipes@@@",
+      "@@@STEP_LOG_END@all recipes@@@",
+      "@@@STEP_LOG_LINE@changed files (raw)@recipes/fuchsia.py@@@",
+      "@@@STEP_LOG_LINE@changed files (raw)@recipes/foo@@@",
+      "@@@STEP_LOG_LINE@changed files (raw)@recipes/non_expected_json_file.json@@@",
+      "@@@STEP_LOG_LINE@changed files (raw)@recipe_modules/foo/examples/full.expected/bar.json@@@",
+      "@@@STEP_LOG_LINE@changed files (raw)@recipe_modules/foo/examples/full.py@@@",
+      "@@@STEP_LOG_LINE@changed files (raw)@recipe_modules/foo/test_api.py@@@",
+      "@@@STEP_LOG_END@changed files (raw)@@@",
+      "@@@STEP_LOG_LINE@changed files (filtered)@recipes/fuchsia.py@@@",
+      "@@@STEP_LOG_LINE@changed files (filtered)@recipes/foo@@@",
+      "@@@STEP_LOG_LINE@changed files (filtered)@recipes/non_expected_json_file.json@@@",
+      "@@@STEP_LOG_END@changed files (filtered)@@@",
+      "@@@STEP_LOG_LINE@affected recipes@none@@@",
+      "@@@STEP_LOG_END@affected recipes@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "listdir",
+      "[START_DIR]/recipes/recipes",
+      "--recursive"
+    ],
+    "infra_step": true,
+    "name": "get_affected_recipes.ls-recipes",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/recipes/recipes/foo@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/recipes/recipes/fuchsia.py@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/recipes/recipes/recipes.py@@@",
+      "@@@STEP_LOG_LINE@listdir@[START_DIR]/recipes/recipes/sdk.expected@@@",
+      "@@@STEP_LOG_END@listdir@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "diff-tree",
+      "--no-commit-id",
+      "--name-only",
+      "-r",
+      "HEAD",
+      "-z"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "get_affected_recipes.git diff-tree",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@files@recipes/fuchsia.py@@@",
+      "@@@STEP_LOG_LINE@files@recipes/foo@@@",
+      "@@@STEP_LOG_LINE@files@recipes/non_expected_json_file.json@@@",
+      "@@@STEP_LOG_LINE@files@recipe_modules/foo/examples/full.expected/bar.json@@@",
+      "@@@STEP_LOG_LINE@files@recipe_modules/foo/examples/full.py@@@",
+      "@@@STEP_LOG_LINE@files@recipe_modules/foo/test_api.py@@@",
+      "@@@STEP_LOG_END@files@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "[START_DIR]/recipes/recipes.py",
+      "analyze",
+      "{\"files\": [\"recipes/fuchsia.py\", \"recipes/foo\", \"recipes/non_expected_json_file.json\"], \"recipes\": [\"fuchsia\", \"recipes\"]}",
+      "/path/to/tmp/json"
+    ],
+    "name": "get_affected_recipes.recipes-analyze",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@json.output@{@@@",
+      "@@@STEP_LOG_LINE@json.output@  \"error\": \"\", @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"invalidRecipes\": [], @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"recipes\": [@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"none\"@@@",
+      "@@@STEP_LOG_LINE@json.output@  ]@@@",
+      "@@@STEP_LOG_LINE@json.output@}@@@",
+      "@@@STEP_LOG_END@json.output@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "get builders",
+    "~followup_annotations": [
+      "@@@STEP_SUMMARY_TEXT@selected 0 builds@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "get builders.flutter/try/flutter-bar",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_SUMMARY_TEXT@skipped@@@",
+      "@@@STEP_LOG_LINE@recipe_used@flutter@@@",
+      "@@@STEP_LOG_END@recipe_used@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "bb",
+      "ls",
+      "-host",
+      "cr-buildbucket.appspot.com",
+      "-json",
+      "-nopage",
+      "-n",
+      "1",
+      "-fields",
+      "builder,create_time,created_by,critical,end_time,id,infra.recipe,input,number,output,start_time,status,update_time",
+      "-predicate",
+      "{\"builder\": {\"bucket\": \"try\", \"builder\": \"flutter-bar\", \"project\": \"flutter\"}, \"status\": \"SUCCESS\"}"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "get builders.flutter/try/flutter-bar.buildbucket.search",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@",
+      "@@@STEP_LOG_LINE@raw_io.output_text@{\"status\": \"SUCCESS\", \"builder\": {\"builder\": \"flutter/try/flutter-bar\"}, \"infra\": {\"recipe\": {\"name\": \"flutter\"}}, \"input\": {\"gerritChanges\": [{\"project\": \"fuchsia\", \"host\": \"fuchsia-review.googlesource.com\"}]}, \"endTime\": \"2012-05-13T12:53:20Z\", \"id\": \"37\"}@@@",
+      "@@@STEP_LOG_END@raw_io.output_text@@@",
+      "@@@STEP_LINK@37@https://cr-buildbucket.appspot.com/build/37@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "get builders.flutter/try/flutter-baz",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_SUMMARY_TEXT@skipped@@@",
+      "@@@STEP_LOG_LINE@recipe_used@project@@@",
+      "@@@STEP_LOG_END@recipe_used@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "bb",
+      "ls",
+      "-host",
+      "cr-buildbucket.appspot.com",
+      "-json",
+      "-nopage",
+      "-n",
+      "1",
+      "-fields",
+      "builder,create_time,created_by,critical,end_time,id,infra.recipe,input,number,output,start_time,status,update_time",
+      "-predicate",
+      "{\"builder\": {\"bucket\": \"try\", \"builder\": \"flutter-baz\", \"project\": \"flutter\"}, \"status\": \"SUCCESS\"}"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "get builders.flutter/try/flutter-baz.buildbucket.search",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@",
+      "@@@STEP_LOG_LINE@raw_io.output_text@{\"status\": \"SUCCESS\", \"builder\": {\"builder\": \"flutter/try/flutter-baz\"}, \"infra\": {\"recipe\": {\"name\": \"project\"}}, \"input\": {\"gerritChanges\": [{\"project\": \"fuchsia\", \"host\": \"fuchsia-review.googlesource.com\"}]}, \"endTime\": \"2012-05-13T12:53:20Z\", \"id\": \"37\"}@@@",
+      "@@@STEP_LOG_END@raw_io.output_text@@@",
+      "@@@STEP_LINK@37@https://cr-buildbucket.appspot.com/build/37@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "get builders.flutter/try/flutter-foo",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_SUMMARY_TEXT@skipped@@@",
+      "@@@STEP_LOG_LINE@recipe_used@flutter@@@",
+      "@@@STEP_LOG_END@recipe_used@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "bb",
+      "ls",
+      "-host",
+      "cr-buildbucket.appspot.com",
+      "-json",
+      "-nopage",
+      "-n",
+      "1",
+      "-fields",
+      "builder,create_time,created_by,critical,end_time,id,infra.recipe,input,number,output,start_time,status,update_time",
+      "-predicate",
+      "{\"builder\": {\"bucket\": \"try\", \"builder\": \"flutter-foo\", \"project\": \"flutter\"}, \"status\": \"SUCCESS\"}"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "get builders.flutter/try/flutter-foo.buildbucket.search",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@",
+      "@@@STEP_LOG_LINE@raw_io.output_text@{\"status\": \"SUCCESS\", \"builder\": {\"builder\": \"flutter/try/flutter-foo\"}, \"infra\": {\"recipe\": {\"name\": \"flutter\"}}, \"input\": {\"gerritChanges\": [{\"project\": \"fuchsia\", \"host\": \"fuchsia-review.googlesource.com\"}]}, \"endTime\": \"2012-05-13T12:53:20Z\", \"id\": \"37\"}@@@",
+      "@@@STEP_LOG_END@raw_io.output_text@@@",
+      "@@@STEP_LINK@37@https://cr-buildbucket.appspot.com/build/37@@@"
+    ]
+  },
+  {
+    "name": "$result"
+  }
+]
\ No newline at end of file
diff --git a/recipes/recipes.expected/cq_try.json b/recipes/recipes.expected/cq_try.json
index 6ee0c68..b62c131 100644
--- a/recipes/recipes.expected/cq_try.json
+++ b/recipes/recipes.expected/cq_try.json
@@ -1,32 +1,211 @@
 [
   {
+    "cmd": [],
+    "name": "fetch master"
+  },
+  {
     "cmd": [
-      "python",
+      "vpython",
       "-u",
-      "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py",
-      "--path",
-      "[START_DIR]/recipes",
-      "--url",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[START_DIR]/recipes"
+    ],
+    "infra_step": true,
+    "name": "fetch master.makedirs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "init"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.git init",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "remote",
+      "add",
+      "origin",
       "https://flutter.googlesource.com/recipes"
     ],
-    "name": "git setup"
+    "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.git remote",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "fetch master.cache",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[CACHE]/git/flutter.googlesource.com-recipes"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "fetch master.cache.makedirs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "init",
+      "--bare"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.cache.git init",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "config",
+      "remote.origin.url",
+      "https://flutter.googlesource.com/recipes"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.cache.remote set-url",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "config",
+      "--replace-all",
+      "remote.origin.fetch",
+      "+refs/heads/*:refs/heads/*",
+      "\\+refs/heads/\\*:.*"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.cache.git config",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
   },
   {
     "cmd": [
       "git",
       "fetch",
+      "--prune",
+      "--tags",
+      "origin"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.cache.git fetch",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[START_DIR]/recipes/.git/objects/info"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "fetch master.cache.makedirs object/info",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CACHE]/git/flutter.googlesource.com-recipes/objects\n",
+      "[START_DIR]/recipes/.git/objects/info/alternates"
+    ],
+    "cwd": "[START_DIR]/recipes",
+    "infra_step": true,
+    "name": "fetch master.cache.alternates",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@",
+      "@@@STEP_LOG_LINE@alternates@[CACHE]/git/flutter.googlesource.com-recipes/objects@@@",
+      "@@@STEP_LOG_END@alternates@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "fetch",
+      "--tags",
       "origin",
-      "master",
-      "--recurse-submodules",
-      "--progress",
-      "--tags"
+      "master"
     ],
     "cwd": "[START_DIR]/recipes",
     "env": {
-      "PATH": "RECIPE_REPO[depot_tools]:<PATH>"
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
     },
-    "infra_step": true,
-    "name": "git fetch"
+    "name": "fetch master.git fetch",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
   },
   {
     "cmd": [
@@ -36,8 +215,14 @@
       "FETCH_HEAD"
     ],
     "cwd": "[START_DIR]/recipes",
-    "infra_step": true,
-    "name": "git checkout"
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.git checkout",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
   },
   {
     "cmd": [
@@ -46,11 +231,13 @@
       "HEAD"
     ],
     "cwd": "[START_DIR]/recipes",
-    "infra_step": true,
-    "name": "read revision",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.git rev-parse",
     "~followup_annotations": [
-      "@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@",
-      "@@@SET_BUILD_PROPERTY@got_revision@\"deadbeef\"@@@"
+      "@@@STEP_NEST_LEVEL@1@@@"
     ]
   },
   {
@@ -62,8 +249,21 @@
       "-x"
     ],
     "cwd": "[START_DIR]/recipes",
-    "infra_step": true,
-    "name": "git clean"
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.git clean",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "fetch master.submodule",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
   },
   {
     "cmd": [
@@ -72,20 +272,300 @@
       "sync"
     ],
     "cwd": "[START_DIR]/recipes",
-    "infra_step": true,
-    "name": "submodule sync"
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.submodule.git submodule sync",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
   },
   {
     "cmd": [
       "git",
       "submodule",
       "update",
-      "--init",
-      "--recursive"
+      "--init"
     ],
     "cwd": "[START_DIR]/recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "fetch master.submodule.git submodule update",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[START_DIR]"
+    ],
     "infra_step": true,
-    "name": "submodule update"
+    "name": "makedirs"
+  },
+  {
+    "cmd": [
+      "git",
+      "init"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git init"
+  },
+  {
+    "cmd": [
+      "git",
+      "remote",
+      "add",
+      "origin",
+      "https://flutter.googlesource.com/recipes"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git remote"
+  },
+  {
+    "cmd": [],
+    "name": "cache"
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[CACHE]/git/flutter.googlesource.com-recipes"
+    ],
+    "infra_step": true,
+    "name": "cache.makedirs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "init",
+      "--bare"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.git init",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "config",
+      "remote.origin.url",
+      "https://flutter.googlesource.com/recipes"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.remote set-url",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "config",
+      "--replace-all",
+      "remote.origin.fetch",
+      "+refs/heads/*:refs/heads/*",
+      "\\+refs/heads/\\*:.*"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.git config",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "fetch",
+      "--prune",
+      "--tags",
+      "origin"
+    ],
+    "cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "cache.git fetch",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "ensure-directory",
+      "--mode",
+      "0777",
+      "[START_DIR]/.git/objects/info"
+    ],
+    "infra_step": true,
+    "name": "cache.makedirs object/info",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CACHE]/git/flutter.googlesource.com-recipes/objects\n",
+      "[START_DIR]/.git/objects/info/alternates"
+    ],
+    "infra_step": true,
+    "name": "cache.alternates",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@alternates@[CACHE]/git/flutter.googlesource.com-recipes/objects@@@",
+      "@@@STEP_LOG_END@alternates@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "fetch",
+      "--tags",
+      "origin",
+      "refs/changes/56/123456/7"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git fetch"
+  },
+  {
+    "cmd": [
+      "git",
+      "checkout",
+      "-f",
+      "FETCH_HEAD"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git checkout"
+  },
+  {
+    "cmd": [
+      "git",
+      "rev-parse",
+      "HEAD"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git rev-parse"
+  },
+  {
+    "cmd": [
+      "git",
+      "clean",
+      "-f",
+      "-d",
+      "-x"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git clean"
+  },
+  {
+    "cmd": [],
+    "name": "submodule"
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
+      "sync"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "submodule.git submodule sync",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "submodule",
+      "update",
+      "--init"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "submodule.git submodule update",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "git",
+      "rebase",
+      "deadbeef"
+    ],
+    "env": {
+      "GIT_HTTP_LOW_SPEED_LIMIT": "2048000",
+      "GIT_HTTP_LOW_SPEED_TIME": "60"
+    },
+    "name": "git rebase"
   },
   {
     "cmd": [
diff --git a/recipes/recipes.py b/recipes/recipes.py
index 554cc74..0bdebdf 100644
--- a/recipes/recipes.py
+++ b/recipes/recipes.py
@@ -1,12 +1,11 @@
 # Copyright 2020 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-
 """Recipe for testing recipes."""
 
 from recipe_engine.recipe_api import Property
 DEPS = [
-    'depot_tools/git',
+    'fuchsia/git',
     'fuchsia/commit_queue',
     'fuchsia/recipe_testing',
     'fuchsia/status_check',
@@ -33,8 +32,7 @@
 # off. In that case alter the recipes build to run on a specific CL that
 # modifies the envtest recipe alone, because that recipe is used by
 # relatively few CQ builders.
-SELFTEST_CL = (
-    'https://flutter-review.git.corp.google.com/c/recipes/+/2280/1')
+SELFTEST_CL = ('https://flutter-review.git.corp.google.com/c/recipes/+/2280/1')
 COMMIT_QUEUE_CFG = """
     submit_options: <
       max_burst: 4
@@ -94,12 +92,14 @@
       >
     >
 """
+
+
 def RunSteps(api, remote, unittest_only):
-  api.git.checkout(
-      remote,
-      recursive=True,
-      set_got_revision=True,
-      tags=True)
+  bb_input = api.buildbucket.build.input
+  if bb_input.gerrit_changes:
+    api.git.checkout_cl(bb_input.gerrit_changes[0], api.path['start_dir'])
+  else:
+    api.git.checkout(remote)
   checkout_path = api.path['start_dir'].join('recipes')
   api.recipe_testing.project = 'flutter'
   api.recipe_testing.run_lint(checkout_path)
@@ -108,16 +108,24 @@
     api.recipe_testing.run_led_tests(checkout_path, SELFTEST_CL)
 
 
-def GenTests(api):  # pylint: disable=invalid-name
-  yield (
-      api.status_check.test('cq_try')
-      + api.properties(unittest_only=False)
-      + api.commit_queue.test_data(COMMIT_QUEUE_CFG)
-      + api.recipe_testing.affected_recipes_data(['none'])
-      + api.recipe_testing.build_data(
-          'flutter/try/flutter-foo', 'flutter', skip=True)
-      + api.recipe_testing.build_data(
-          'flutter/try/flutter-bar', 'flutter', skip=True)
-      + api.recipe_testing.build_data(
-          'flutter/try/flutter-baz', 'project', skip=True)
-  )  # yapf: disable
+def GenTests(api):
+  yield (api.status_check.test('ci') + api.properties(unittest_only=False) +
+         api.commit_queue.test_data(COMMIT_QUEUE_CFG) +
+         api.recipe_testing.affected_recipes_data(['none']) +
+         api.recipe_testing.build_data(
+             'flutter/try/flutter-foo', 'flutter', skip=True) +
+         api.recipe_testing.build_data(
+             'flutter/try/flutter-bar', 'flutter', skip=True) +
+         api.recipe_testing.build_data(
+             'flutter/try/flutter-baz', 'project', skip=True))
+  yield (api.status_check.test('cq_try') + api.properties(unittest_only=False) +
+         api.commit_queue.test_data(COMMIT_QUEUE_CFG) +
+         api.recipe_testing.affected_recipes_data(['none']) +
+         api.recipe_testing.build_data(
+             'flutter/try/flutter-foo', 'flutter', skip=True) +
+         api.recipe_testing.build_data(
+             'flutter/try/flutter-bar', 'flutter', skip=True) +
+         api.recipe_testing.build_data(
+             'flutter/try/flutter-baz', 'project', skip=True) +
+         api.buildbucket.try_build(
+             git_repo='https://flutter.googlesource.com/recipes'))