code: def test_update_follow_parentds_lazy_other_branch(path=None):
      path = Path(path)
      ds_src = Dataset(path / "source").create()
      ds_src_sub = ds_src.create("sub")
      ds_src_sub.repo.checkout(DEFAULT_BRANCH, options=["-bother"])
      (ds_src_sub.pathobj / "foo").write_text("on other branch")
      ds_src_sub.save()
      ds_src_sub.repo.checkout(DEFAULT_BRANCH)
      ds_src.save(recursive=True)
      assert_repo_status(ds_src.path)
  
      ds_clone = install(
          source=ds_src.path,
          path=path / "clone",
          recursive=True,
          result_xfm="datasets",
      )
      ds_src_sub.repo.checkout("other")
      ds_src.save(recursive=True)
  
      with patch("datalad.support.gitrepo.GitRepo.fetch") as fetch_cmd:
          ds_clone.update(
              follow="parentds",
              merge="ff-only",
              recursive=True,
              on_failure="ignore",
          )
          eq_(fetch_cmd.call_count, 2)
  
      # With parentds-lazy, an unneeded fetch call in the subdataset is dropped.
      with patch("datalad.support.gitrepo.GitRepo.fetch") as fetch_cmd:
          ds_clone.update(
              follow="parentds-lazy",
              merge="ff-only",
              recursive=True,
              on_failure="ignore",
          )
          eq_(fetch_cmd.call_count, 1)
  
      if not ds_clone.repo.is_managed_branch():
          # Now the real thing.
          ds_clone.update(
              follow="parentds-lazy", merge="ff-only", recursive=True
          )
          ok_(op.lexists(str(ds_clone.pathobj / "sub" / "foo")))
  
imports: import os
  import os.path
  from os.path import exists
  from os.path import join
  from unittest.mock import patch
  import pytest
  from datalad import cfg
  from datalad.api import clone, install, remove, update
  from datalad.distribution.update import _process_how_args
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.external_versions import external_versions
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, SkipTest, assert_false, assert_in, assert_in_results, assert_is_instance, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_status, create_tree, eq_, known_failure_windows, maybe_adjust_repo, neq_, ok_, ok_file_has_content, skip_if_adjusted_branch, slow, with_tempfile
  from datalad.utils import Path, chpwd, knows_annex, rmtree
  from ..dataset import Dataset
label_desc: Use image node_id 18 for calling a global function with example usage: test_update_follow_parentds_lazy_other_branch(path) without return types