code: def test_init_when_ignored_by_git(tmp_dir, scm, caplog):
      # https://github.com/iterative/dvc/issues/3738
      tmp_dir.gen({".gitignore": ".*"})
      with caplog.at_level(logging.ERROR, logger="dvc"):
          assert main(["init"]) == 1
      assert (
          f"{tmp_dir / DvcRepo.DVC_DIR} is ignored by your SCM tool. \n"
          "Make sure that it's tracked, "
          "for example, by adding '!.dvc' to .gitignore." in caplog.text
      )
  
file_path: dvc/tests/func/test_init.py
imports: import logging
  import os
  import pytest
  from dvc.cli import main
  from dvc.config import Config
  from dvc.exceptions import InitError
  from dvc.repo import Repo
label_desc: Use image node_id 12 for calling a global function with example usage: test_init_when_ignored_by_git(tmp_dir, scm, caplog) without return types