code: def _test_bare_git_version_1(host, dspath, store):
      # This test should take a dataset and create a bare repository at the remote
      # end from it.
      # Given, that it is placed correctly within a tree of dataset, that remote
      # thing should then be usable as an ora-remote as well as as a git-type
      # remote.
      # Note: Usability of git remote by annex depends on dataset layout version
      #       (dirhashlower vs. -mixed).
      #       For version 1 (lower) upload and consumption should be
      #       interchangeable. It doesn't matter which remote is used for what
      #       direction.
      ds_path = Path(dspath)
      store = Path(store)
      ds = Dataset(ds_path).create()
      populate_dataset(ds)
  
      bare_repo_path, _, objdir = get_layout_locations(1, store, ds.id)
      # Use git to make sure the remote end is what git thinks a bare clone of it
      # should look like
      subprocess.run(
          [
              "git",
              "clone",
              "--bare",
              quote_cmdlinearg(str(dspath)),
              quote_cmdlinearg(str(bare_repo_path)),
          ]
      )
  
      if host:
          url = "ria+ssh://{host}{path}".format(host=host, path=store)
      else:
          url = "ria+{}".format(store.as_uri())
      init_opts = common_init_opts + ["url={}".format(url)]
      # set up store:
      io = SSHRemoteIO(host) if host else LocalIO()
      create_store(io, store, "1")
      # set up the dataset location, too.
      # Note: Dataset layout version 1 (dirhash lower):
      create_ds_in_store(
          io, store, ds.id, "1", "1", init_obj_tree=False
      )
  
      # Now, let's have the bare repo as a git remote and use it with annex
      git_url = (
          "ssh://{host}{path}".format(host=host, path=bare_repo_path)
          if host
          else bare_repo_path.as_uri()
      )
      ds.repo.add_remote("bare-git", git_url)
      ds.repo.enable_remote("bare-git")
  
      # copy files to the remote
      ds.push(".", to="bare-git")
      eq_(len(ds.repo.whereis("one.txt")), 2)
  
      # now we can drop all content locally, reobtain it, and survive an
      # fsck
      ds.drop(".")
      ds.get(".")
      assert_status(
          "ok", [annexjson2result(r, ds) for r in ds.repo.fsck()]
      )
  
      # Now, add the ora remote:
      ds.repo.init_remote("ora-remote", options=init_opts)
      # fsck to make availability known
      assert_status(
          "ok",
          [
              annexjson2result(r, ds)
              for r in ds.repo.fsck(remote="ora-remote", fast=True)
          ],
      )
      eq_(len(ds.repo.whereis("one.txt")), 3)
  
      # Now move content from git-remote to local and see it not being available
      # via bare-git anymore.
      ds.repo.call_annex(["move", "--all", "--from=bare-git"])
      # ora-remote doesn't know yet:
      eq_(len(ds.repo.whereis("one.txt")), 2)
  
      # But after fsck it does:
      fsck_res = [
          annexjson2result(r, ds)
          for r in ds.repo.fsck(remote="ora-remote", fast=True)
      ]
      assert_result_count(
          fsck_res,
          1,
          status="error",
          error_message="** Based on the location log, one.txt\n"
          "** was expected to be present, "
          "but its content is missing.",
      )
      assert_result_count(
          fsck_res,
          1,
          status="error",
          error_message="** Based on the location log, subdir/two\n"
          "** was expected to be present, "
          "but its content is missing.",
      )
      eq_(len(ds.repo.whereis("one.txt")), 1)
      # and the other way around: upload via ora-remote and have it available via
      # git-remote:
      ds.push(".", to="ora-remote")
      # fsck to make availability known
      assert_status(
          "ok",
          [
              annexjson2result(r, ds)
              for r in ds.repo.fsck(remote="bare-git", fast=True)
          ],
      )
      eq_(len(ds.repo.whereis("one.txt")), 3)
  
file_path: datalad/datalad/distributed/tests/test_ria_git_remote.py
imports: import subprocess
  from datalad.api import Dataset, clone
  from datalad.customremotes.ria_utils import create_ds_in_store, create_store, get_layout_locations
  from datalad.distributed.ora_remote import LocalIO, SSHRemoteIO
  from datalad.distributed.tests.ria_utils import common_init_opts, populate_dataset
  from datalad.interface.results import annexjson2result
  from datalad.tests.utils_pytest import assert_result_count, assert_status, eq_, known_failure_windows, skip_ssh, slow, with_tempfile
  from datalad.utils import Path, quote_cmdlinearg
label_desc: Use image node_id 1 for calling a global function with example usage: _test_bare_git_version_1(host, dspath, store) without return types