code: def test_bare(src=None, path=None):
      # create a proper datalad dataset with all bells and whistles
      ds = Dataset(src).create()
      dlconfig_sha = ds.repo.call_git(
          ["rev-parse", "HEAD:.datalad/config"]
      ).strip()
      # can we handle a bare repo version of it?
      gr = AnnexRepo.clone(
          src, path, clone_options=["--bare", "-b", DEFAULT_BRANCH]
      )
      # we had to specifically checkout the standard branch, because on crippled
      # FS, HEAD will point to an adjusted branch by default, and the test logic
      # below does not account for this case.
      # this should just make sure the bare repo has the expected setup,
      # but it should still be bare. Let's check that to be sure
      assert_true(gr.bare)
      # do we read the correct local config?
      assert_in(
          gr.pathobj / "config", gr.config._stores["git"]["files"]
      )
      # do we pick up the default branch config too?
      assert_in(
          "blob:HEAD:.datalad/config",
          gr.config._stores["branch"]["files"],
      )
      # and track its reload stamp via its file shasum
      assert_equal(
          dlconfig_sha,
          gr.config._stores["branch"]["stats"][
              "blob:HEAD:.datalad/config"
          ],
      )
      # check that we can pick up the dsid from the commit branch config
      assert_equal(ds.id, gr.config.get("datalad.dataset.id"))
      # and it is coming from the correct source
      assert_equal(
          ds.id,
          gr.config.get_from_source("branch", "datalad.dataset.id"),
      )
      assert_equal(
          None, gr.config.get_from_source("local", "datalad.dataset.id")
      )
      # any sensible (and also our CI) test environment(s) should have this
      assert_in("user.name", gr.config)
      # not set something that wasn't there
      obscure_key = "sec.reallyobscurename!@@.key"
      assert_not_in(obscure_key, gr.config)
      # to the local config, which is easily accessible
      gr.config.set(obscure_key, "myvalue", scope="local")
      assert_equal(gr.config.get(obscure_key), "myvalue")
      # now make sure the config is where we think it is
      assert_in(
          obscure_key.split(".")[1], (gr.pathobj / "config").read_text()
      )
      # update committed config and check update
      old_id = ds.id
      ds.config.set("datalad.dataset.id", "surprise!", scope="branch")
      ds.save()
      # fetch into default branch (like `update`, but for bare-repos)
      gr.call_git(
          [
              "fetch",
              f"{DEFAULT_REMOTE}",
              f"{DEFAULT_BRANCH}:{DEFAULT_BRANCH}",
          ]
      )
      # without a reload, no state change, like with non-bare repos
      assert_equal(
          old_id,
          gr.config.get_from_source("branch", "datalad.dataset.id"),
      )
      # a non-forced reload() must be enough, because state change
      # detection kicks in
      gr.config.reload()
      assert_equal("surprise!", gr.config.get("datalad.dataset.id"))
  
imports: import logging
  import os
  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 create
  from datalad.cmd import CommandError
  from datalad.config import ConfigManager, _where_to_scope, parse_gitconfig_dump, rewrite_url, write_config_section
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, assert_equal, assert_false, assert_in, assert_not_equal, assert_not_in, assert_raises, assert_true, chpwd, ok_file_has_content, with_tempfile, with_testsui, with_tree
  from datalad.utils import Path, get_home_envvars, swallow_logs
label_desc: Use image node_id 15 for calling a global function with example usage: test_bare(src, path) without return types