code: def test_bf1886(path=None):
      parent = Dataset(path).create()
      parent.create("sub")
      assert_repo_status(parent.path)
      # create a symlink pointing down to the subdataset, and add it
      os.symlink("sub", op.join(parent.path, "down"))
      parent.save("down")
      assert_repo_status(parent.path)
      # now symlink pointing up
      os.makedirs(op.join(parent.path, "subdir", "subsubdir"))
      os.symlink(
          op.join(op.pardir, "sub"),
          op.join(parent.path, "subdir", "up"),
      )
      parent.save(op.join("subdir", "up"))
      # 'all' to avoid the empty dir being listed
      assert_repo_status(parent.path, untracked_mode="all")
      # now symlink pointing 2xup, as in #1886
      os.symlink(
          op.join(op.pardir, op.pardir, "sub"),
          op.join(parent.path, "subdir", "subsubdir", "upup"),
      )
      parent.save(op.join("subdir", "subsubdir", "upup"))
      assert_repo_status(parent.path)
      # simultaneously add a subds and a symlink pointing to it
      # create subds, but don't register it
      create(op.join(parent.path, "sub2"))
      os.symlink(
          op.join(op.pardir, op.pardir, "sub2"),
          op.join(parent.path, "subdir", "subsubdir", "upup2"),
      )
      parent.save(["sub2", op.join("subdir", "subsubdir", "upup2")])
      assert_repo_status(parent.path)
      # full replication of #1886: the above but be in subdir of symlink
      # with no reference dataset
      create(op.join(parent.path, "sub3"))
      os.symlink(
          op.join(op.pardir, op.pardir, "sub3"),
          op.join(parent.path, "subdir", "subsubdir", "upup3"),
      )
      # need to use absolute paths
      with chpwd(op.join(parent.path, "subdir", "subsubdir")):
          save(
              [
                  op.join(parent.path, "sub3"),
                  op.join(parent.path, "subdir", "subsubdir", "upup3"),
              ]
          )
      assert_repo_status(parent.path)
  
imports: import itertools
  import logging
  import os
  import os.path
  import pytest
  import datalad.utils
  from datalad.api import create, install, save
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandError
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, OBSCURE_FILENAME, SkipTest, assert_in, assert_in_results, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_status, chpwd, create_tree, eq_, known_failure, known_failure_windows, maybe_adjust_repo, neq_, ok_, patch, skip_if_adjusted_branch, skip_wo_symlink_capability, swallow_logs, swallow_outputs, with_tempfile, with_tree
  from datalad.utils import Path, ensure_list, rmtree
label_desc: Use image node_id 8 for calling a global function with example usage: test_bf1886(path) without return types