code: def test_shallow_clone_tag(erepo_dir, mocker):
      with erepo_dir.chdir():
          erepo_dir.dvc_gen("file", "foo", commit="init")
          erepo_dir.scm.tag("v1")
          erepo_dir.dvc_gen("file", "bar", commit="update file")
  
      url = os.fspath(erepo_dir)
  
      clone_spy = mocker.spy(Git, "clone")
      with external_repo(url, rev="v1") as repo:
          with repo.dvcfs.open("file") as fd:
              assert fd.read() == "foo"
  
      clone_spy.assert_called_with(
          url, mocker.ANY, shallow_branch="v1", progress=mocker.ANY
      )
  
      path, _ = CLONES[url]
      CLONES[url] = (path, True)
  
      mock_fetch = mocker.patch.object(Git, "fetch")
      with external_repo(url, rev="master") as repo:
          with repo.dvcfs.open("file") as fd:
              assert fd.read() == "bar"
      mock_fetch.assert_called_with(unshallow=True)
  
file_path: dvc/tests/func/test_external_repo.py
imports: import os
  from dvc.repo.open_repo import CLONES
  from dvc.repo.open_repo import _external_repo
  from dvc.scm import Git
  from dvc.testing.tmp_dir import make_subrepo
  from dvc.utils import relpath
  from dvc.utils.fs import remove
  from dvc_data.hashfile.build import build
  from dvc_data.hashfile.transfer import transfer
label_desc: Use image node_id 8 for calling a global function with example usage: test_shallow_clone_tag(erepo_dir, mocker) without return types