code: def test_status_symlinked_dir_within_repo(path=None):
      if not has_symlink_capability():
          raise SkipTest("Can't create symlinks")
      # <path>
      # |-- bar -> <path>/foo
      # `-- foo
      #     `-- f
      ds = Dataset(path).create()
      foo = ds.pathobj / "foo"
      foo.mkdir()
      (foo / "f").write_text("content")
      (ds.pathobj / "bar").symlink_to(foo, target_is_directory=True)
      ds.save()
      bar_f = ds.pathobj / "bar" / "f"
  
      def call():
          return ds.status(
              path=[bar_f],
              annex="availability",
              on_failure="ignore",
              result_renderer="disabled",
          )
  
      if ds.repo.git_annex_version < "8.20200522" or (
          on_windows and ds.repo.git_annex_version < "10.20220525"
      ):
          # version for windows is an approx guess, but stopped happening
          # somewhere around 10.20220505-g3b83224e5 may be.
          # see https://github.com/datalad/datalad/issues/6849
          assert_result_count(call(), 0)
      elif ds.repo.git_annex_version < "10.20220222":
          # As of 2a8fdfc7d (Display a warning message when asked to operate on a
          # file inside a symlinked directory, 2020-05-11), git-annex will error.
          with assert_raises(CommandError):
              call()
      elif "10.20220222" <= ds.repo.git_annex_version < "10.20220322":
          # No error on annex' side since 10.20220222;
          # However, we'd now get something like this:
          # > git annex find bar/f
          # error: pathspec 'bar/f' did not match any file(s) known to git
          # Did you forget to 'git add'?
          #
          # But exists zero until 10.20220322!
          assert_result_count(call(), 0)
      else:
          res = call()
          assert_result_count(
              res, 1, status="error", state="unknown", path=str(bar_f)
          )
  
file_path: datalad/datalad/core/local/tests/test_status.py
imports: import os.path
  import datalad.utils
  from datalad.api import status
  from datalad.core.local.status import get_paths_by_ds
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandError, IncompleteResultsError, NoDatasetFound
  from datalad.tests.utils_pytest import OBSCURE_FILENAME, SkipTest, assert_dict_equal, assert_in, assert_in_results, assert_not_in_results, assert_raises, assert_repo_status, assert_result_count, assert_status, eq_, get_deeply_nested_structure, has_symlink_capability, with_tempfile
  from datalad.utils import chpwd, on_windows
label_desc: Use image node_id 7 for calling a global function with example usage: test_status_symlinked_dir_within_repo(path) and returns: ds