code: def test_commit_granular_dir(tmp_dir, dvc):
      tmp_dir.gen(
          {
              "data": {
                  "foo": "foo",
                  "bar": "bar",
                  "subdir": {"subfoo": "subfoo", "subbar": "subbar"},
              }
          }
      )
      dvc.add("data", no_commit=True)
  
      cache = tmp_dir / ".dvc" / "cache" / "files" / "md5"
  
      assert set(cache.glob("*/*")) == set()
  
      dvc.commit(os.path.join("data", "foo"))
      assert set(cache.glob("*/*")) == {
          cache / "1a" / "ca2c799df82929bbdd976557975546.dir",
          cache / "ac" / "bd18db4cc2f85cedef654fccc4a4d8",
      }
  
      dvc.commit(os.path.join("data", "subdir"))
      assert set(cache.glob("*/*")) == {
          cache / "1a" / "ca2c799df82929bbdd976557975546.dir",
          cache / "ac" / "bd18db4cc2f85cedef654fccc4a4d8",
          cache / "4c" / "e8d2a2cf314a52fa7f315ca37ca445",
          cache / "68" / "dde2c3c4e7953c2290f176bbdc9a54",
      }
  
      dvc.commit(os.path.join("data"))
      assert set(cache.glob("*/*")) == {
          cache / "1a" / "ca2c799df82929bbdd976557975546.dir",
          cache / "ac" / "bd18db4cc2f85cedef654fccc4a4d8",
          cache / "4c" / "e8d2a2cf314a52fa7f315ca37ca445",
          cache / "68" / "dde2c3c4e7953c2290f176bbdc9a54",
          cache / "37" / "b51d194a7513e45b56f6524f2d51f2",
      }
  
imports: import os
  import textwrap
  import pytest
  from dvc.dependency.base import DependencyDoesNotExistError
  from dvc.dvcfile import PROJECT_FILE
  from dvc.fs import localfs
  from dvc.output import OutputDoesNotExistError
  from dvc.stage.exceptions import StageCommitError
label_desc: Use image node_id 10 for calling a global function with example usage: test_commit_granular_dir(tmp_dir, dvc) without return types