code: def test_update_unborn_master(path=None):
      ds_a = Dataset(op.join(path, "ds-a")).create()
      ds_a.repo.call_git(["branch", "-m", DEFAULT_BRANCH, "other"])
      ds_a.repo.checkout(DEFAULT_BRANCH, options=["--orphan"])
      ds_b = install(source=ds_a.path, path=op.join(path, "ds-b"))
  
      ds_a.repo.checkout("other")
      (ds_a.pathobj / "foo").write_text("content")
      ds_a.save()
  
      # clone() will try to switch away from an unborn branch if there
      # is another ref available.  Reverse these efforts so that we can
      # test that update() fails reasonably here because we should still
      # be able to update from remotes that datalad didn't clone.
      ds_b.repo.update_ref(
          "HEAD", "refs/heads/" + DEFAULT_BRANCH, symbolic=True
      )
      assert_false(ds_b.repo.commit_exists("HEAD"))
      assert_status(
          "impossible", ds_b.update(merge=True, on_failure="ignore")
      )
  
      ds_b.repo.checkout("other")
      assert_status("ok", ds_b.update(merge=True, on_failure="ignore"))
      eq_(ds_a.repo.get_hexsha(), ds_b.repo.get_hexsha())
  
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 16 for calling a global function with example usage: test_update_unborn_master(path) without return types