code: def check_save_dotfiles(to_git, save_path, path):
      # Note: Take relpath to work with Travis "TMPDIR=/var/tmp/sym\ link" run.
      paths = [
          Path(op.relpath(op.join(root, fname), path))
          for root, _, fnames in os.walk(op.join(path, save_path or ""))
          for fname in fnames
      ]
      ok_(paths)
      ds = Dataset(path).create(force=True)
      ds.save(save_path, to_git=to_git)
      if save_path is None:
          assert_repo_status(ds.path)
      repo = ds.repo
      annexinfo = repo.get_content_annexinfo()
  
      def _check(fn, p):
          fn("key", annexinfo[repo.pathobj / p], p)
  
      if to_git:
  
          def check(p):
              _check(assert_not_in, p)
  
      else:
  
          def check(p):
              _check(assert_in, p)
  
      for path in paths:
          check(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 30 for calling a global function with example usage: check_save_dotfiles(to_git, save_path, path) without return types