code: def test_get_subdataset_direct_fetch(path=None):
      path = Path(path)
      origin = Dataset(path / "origin").create()
      for sub in ["s0", "s1"]:
          sds = origin.create(origin.pathobj / sub)
          sds.repo.commit(
              msg="another commit", options=["--allow-empty"]
          )
      origin.save()
      s0 = Dataset(origin.pathobj / "s0")
      s1 = Dataset(origin.pathobj / "s1")
      # Abandon the recorded commit so that it needs to be brought down by a
      # direct fetch.
      s0.repo.call_git(["reset", "--hard", "HEAD~"])
      s1.repo.call_git(["reset", "--hard", "HEAD~"])
  
      # Tweak the configuration of s0 to make the direct fetch fail.
      # Disallow direct oid fetch (default).
      s0.repo.config.set(
          "uploadpack.allowAnySHA1InWant", "false", scope="local"
      )
      # Configure the fetcher to avoid v2, which allows fetching unadvertised
      # objects regardless of the value of uploadpack.allowAnySHA1InWant.
      s0.repo.config.set("protocol.version", "0", scope="local")
  
      # Configure s1 to succeed with direct fetch.
      s1.repo.config.set(
          "uploadpack.allowAnySHA1InWant", "true", scope="local"
      )
  
      clone = install(
          str(path / "clone"),
          source="ssh://datalad-test:" + origin.repo.pathobj.as_posix(),
      )
  
      res = clone.get(["s0", "s1"], on_failure="ignore")
      assert_result_count(
          res, 1, action="install", type="dataset", status="error"
      )
      assert_result_count(
          res, 1, action="install", type="dataset", status="ok"
      )
  
imports: from os import curdir
  from os.path import basename
  from os.path import join
  from unittest.mock import patch
  import pytest
  from datalad.api import clone, create, get, install
  from datalad.distribution.get import _get_flexible_source_candidates_for_submodule
  from datalad.interface.results import only_matching_paths
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import InsufficientArgumentsError, RemoteNotAvailableError
  from datalad.support.network import get_local_file_url
  from datalad.tests.utils_testdatasets import _make_dataset_hierarchy, _mk_submodule_annex
  from datalad.tests.utils_pytest import create_tree, assert_false, assert_raises, assert_in, assert_status, assert_in_results, assert_not_in_results, assert_repo_status, assert_result_count, assert_message, DEFAULT_REMOTE, eq_, known_failure_windows, known_failure_githubci_win, ok_, serve_path_via_http, skip_if_adjusted_branch, skip_ssh, skip_if_on_windows, slow, with_tempfile, with_tree
  from datalad.utils import Path, chpwd, rmtree, with_pathsep
  from ..dataset import Dataset
label_desc: Use image node_id 15 for calling a global function with example usage: test_get_subdataset_direct_fetch(path) without return types