code: def test_init_fail_under_known_subdir(path=None):
      repo = GitRepo(path).init()
      repo.call_git(["add", op.join("subds", "file_name")])
      # Should fail even if we do not commit but only add to index:
      with assert_raises(PathKnownToRepositoryError) as cme:
          GitRepo(op.join(path, "subds")).init()
      assert_in(
          "file_name", str(cme.value)
      )  # we provide a list of offenders
      # and after we commit - the same story
      repo.call_git(["commit", "-m", "added file"])
      with assert_raises(PathKnownToRepositoryError) as cme:
          GitRepo(op.join(path, "subds")).init()
  
      # But it would succeed if we disable the checks
      GitRepo(op.join(path, "subds")).init(sanity_checks=False)
  
imports: import logging
  import os
  import os.path
  import sys
  from datalad.dataset.gitrepo import GitRepo, _get_dot_git
  from datalad.support.exceptions import CommandError, PathKnownToRepositoryError
  from datalad.tests.utils_pytest import SkipTest, assert_cwd_unchanged, assert_equal, assert_false, assert_in, assert_is_instance, assert_not_in, assert_raises, eq_, neq_, ok_, swallow_logs, with_tempfile, with_tree
  from datalad.utils import Path, chpwd
label_desc: Use image node_id 5 for calling a global function with example usage: test_init_fail_under_known_subdir(path) without return types