code: def test_ignore_on_branch(tmp_dir, scm, dvc):
      from dvc.fs import GitFileSystem
  
      tmp_dir.scm_gen({"foo": "foo", "bar": "bar"}, commit="add files")
  
      with tmp_dir.branch("branch", new=True):
          tmp_dir.scm_gen(
              DvcIgnore.DVCIGNORE_FILE, "foo", commit="add ignore"
          )
  
      dvc._reset()
  
      result = dvc.dvcignore.find(dvc.fs, tmp_dir)
      assert set(result) == {
          (tmp_dir / "foo").fs_path,
          (tmp_dir / "bar").fs_path,
          (tmp_dir / DvcIgnore.DVCIGNORE_FILE).fs_path,
      }
  
      dvc.fs = GitFileSystem(scm=scm, rev="branch")
      dvc.root_dir = "/"
      assert dvc.dvcignore.is_ignored_file("/foo")
  
imports: import os
  import shutil
  from pathlib import Path
  from typing import List
  import pytest
  from dvc.ignore import DvcIgnore, DvcIgnorePatterns
  from dvc.output import OutputIsIgnoredError
  from dvc.pathspec_math import PatternInfo, merge_patterns
  from dvc.repo import Repo
  from dvc.testing.tmp_dir import TmpDir
  from dvc_data.hashfile.build import IgnoreInCollectedDirError
  from dvc_data.hashfile.utils import get_mtime_and_size
label_desc: Use image node_id 10 for calling a global function with example usage: test_ignore_on_branch(tmp_dir, scm, dvc) without return types